I have a table (tblInvUsed) with a field called CaseNum which contains multiple records for one CaseNum. In a Class module from a form (frmCaseEntryDr) I want to open this table and check the set of records with the same CaseNum that is active on the form for certain drugs ordered for a procedure. I have used the following code and have received "Error 3061: Too few parameters: Expected 1"
Access reads the lngCaseNum correctly in the Debug Window. The strSQL appears to be written just like the help file states, but I must be doing something wrong - I suspect it is in the WHERE statement.
Thanks for your help.
Bob
Code:
Dim db as Database, rst as Recoreset, lngCaseNum as Long
lngCaseNum = Me.CaseNum
strSQL = "SELECT * FROM tblInvUsed [COLOR=red]WHERE '[CaseNum] = ' & lngCaseNum [/color red]"
Set db = CurrentDb
Set rst = db.OpenRecordset(strSQL)
Access reads the lngCaseNum correctly in the Debug Window. The strSQL appears to be written just like the help file states, but I must be doing something wrong - I suspect it is in the WHERE statement.
Thanks for your help.
Bob