Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Passing Parameters to Access View
Message
De
12/07/2003 01:18:13
Rene Lovino
Bigfoot Global Solutions, Inc
Cebu, Philippines
 
 
À
11/07/2003 23:28:51
Information générale
Forum:
Visual Basic
Catégorie:
Bases de données DAO/RDO/ODBC/ADO
Divers
Thread ID:
00809104
Message ID:
00809529
Vues:
32
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
Fil
Voir

Click here to load this message in the networking platform