K
kagard
Greetings:
I keep getting "No value given for one or more required parameters,"
when trying to open a recordset. Here's the pertinent code:
Dim rsProgram As ADODB.Recordset
SQLStmt = "SELECT * FROM tblPrograms WHERE Mid([strProgramNumber],
6, 2)='" & ProgramType & "';"
Set rsProgram = New ADODB.Recordset
rsProgram.Open SQLStmt, CurrentProject.Connection, adOpenStatic,
adLockOptimistic
The error appears on execution of the last line. When I drop the WHERE
clause, the code works but, obviously, grabs more records than I need.
In the Immediate window, I get the following results in break mode:
? Mid([strProgramNumber], 6, 2)
S1
? ProgramType
S1
? Mid([strProgramNumber], 6, 2) = ProgramType
True
I don't see what I'm doing wrong. Any ideas. TIA
Keith
I keep getting "No value given for one or more required parameters,"
when trying to open a recordset. Here's the pertinent code:
Dim rsProgram As ADODB.Recordset
SQLStmt = "SELECT * FROM tblPrograms WHERE Mid([strProgramNumber],
6, 2)='" & ProgramType & "';"
Set rsProgram = New ADODB.Recordset
rsProgram.Open SQLStmt, CurrentProject.Connection, adOpenStatic,
adLockOptimistic
The error appears on execution of the last line. When I drop the WHERE
clause, the code works but, obviously, grabs more records than I need.
In the Immediate window, I get the following results in break mode:
? Mid([strProgramNumber], 6, 2)
S1
? ProgramType
S1
? Mid([strProgramNumber], 6, 2) = ProgramType
True
I don't see what I'm doing wrong. Any ideas. TIA
Keith