michellecole
Programmer
I am working with an Adodc in VB with Access as the Back End. There is an ODBC Driver called "BranchErrors".
Here are the settings on the adodc1.property page:
CommandType = 8 - adCmdUnknown
ConnectionString = DSN=BranchErrors
CursorLocations = 3 - adUseClient
CursorType = 2 - adOpenDynamic
RecordSource = **This is where I need help
When I set the Adodc1.RecordSource property with SQL, how do I pass a long integer in the sql statement. If I replace the lngTrayID with a number in the sql statement, all is good - but I need to pass it as a variable. How do I pass a variable containing a number.
On the property page for the adodc I've tried the following sql statments in the RecordSource property:
1)
SELECT * FROM tblDocPrep_BatchScan
WHERE tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = & lngTrayID ORDER BY tblDocPrep_BatchScan.Time;
and get the following Error Message:
[Microsoft][ODBC Microsoft Access Driver] Syntax Error (missing operator) in query expression 'tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = & lngTrayID'.
2)
SELECT * FROM tblDocPrep_BatchScan
WHERE tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = & lngTrayID & ORDER BY tblDocPrep_BatchScan.Time;
Error Message:
[Microsoft][ODBC Microsoft Access Driver] Syntax Error (missing operator) in query expression 'tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = & lngTrayID &'.
3)
SELECT * FROM tblDocPrep_BatchScan
WHERE tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = lngTrayID ORDER BY tblDocPrep_BatchScan.Time;
Error Message:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Maybe I have the other property settings not set correctly?
Thank you to the sql guru,
Michelle
Here are the settings on the adodc1.property page:
CommandType = 8 - adCmdUnknown
ConnectionString = DSN=BranchErrors
CursorLocations = 3 - adUseClient
CursorType = 2 - adOpenDynamic
RecordSource = **This is where I need help
When I set the Adodc1.RecordSource property with SQL, how do I pass a long integer in the sql statement. If I replace the lngTrayID with a number in the sql statement, all is good - but I need to pass it as a variable. How do I pass a variable containing a number.
On the property page for the adodc I've tried the following sql statments in the RecordSource property:
1)
SELECT * FROM tblDocPrep_BatchScan
WHERE tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = & lngTrayID ORDER BY tblDocPrep_BatchScan.Time;
and get the following Error Message:
[Microsoft][ODBC Microsoft Access Driver] Syntax Error (missing operator) in query expression 'tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = & lngTrayID'.
2)
SELECT * FROM tblDocPrep_BatchScan
WHERE tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = & lngTrayID & ORDER BY tblDocPrep_BatchScan.Time;
Error Message:
[Microsoft][ODBC Microsoft Access Driver] Syntax Error (missing operator) in query expression 'tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = & lngTrayID &'.
3)
SELECT * FROM tblDocPrep_BatchScan
WHERE tblDocPrep_BatchScan.IsRecActive = 'Yes' AND tblDocPrep_BatchScan.TrayID = lngTrayID ORDER BY tblDocPrep_BatchScan.Time;
Error Message:
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
Maybe I have the other property settings not set correctly?
Thank you to the sql guru,
Michelle