Information générale
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Noel,
Your missing something in your code.
The following is the part of your code that I have extracted.
objCon.Open ConnectionString
objCmd.ActiveConnection = objCon
objCmd.CommandText = "qrySALES"
objCmd.CommandType = adCmdStoredProc
Set objPar = objCmd.CreateParameter("DATE", adDBDate, adParamInput, 12, txtDateFrom)
objCmd.Parameters.Append objPar
Set objPar = objCmd.CreateParameter("DATE", adDBDate, adParamInput, 12, txtDateTo)
objCmd.Parameters.Append objPar
Set objRst = objCmd.Execute
Note that CreateParameter function you supply the same
parameter name which is CreateParameter("DATE",....).
Take a look on your code your using "DATE" and "DATE" parameter.
May be it should be "DATE1" and "DATE2" respectively.
You need to supply the name of your parameter correctly.
Do not use the same name of the query parameter.
example you have the following access query:
PARAMETERS param1 Text ( 255 ), param2 Text ( 255 );
SELECT Tbl1.field1, Tbl1.field2
FROM Tbl1
WHERE Tbl1.field1 = param1 and Tbl1.field2 = param2;
your VB code must like this.
Set objPar = objCmd.CreateParameter("param1", adDBDate, adParamInput, 12, txtDateFrom)
objCmd.Parameters.Append objPar
Set objPar = objCmd.CreateParameter("param2", adDBDate, adParamInput, 12, txtDateTo)
objCmd.Parameters.Append objPar
Précédent
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement