Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing Parameters to Access View
Message
From
12/07/2003 01:18:13
Rene Lovino
Bigfoot Global Solutions, Inc
Cebu, Philippines
 
 
To
11/07/2003 23:28:51
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00809104
Message ID:
00809529
Views:
31
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform