Error with Recordset Open using SQL statment

outside1

New member
Local time
Today, 03:34
Joined
Jun 28, 2001
Messages
8
I am trying to use the code below to open a Recordset yet I get an error “ No value given for one or more of the parameters”

rstScopeQuery.Open "SELECT [line_data_id],[section_id], [chk_status] " & _
"FROM section_detail WHERE (((section_id) = [Forms]![frmJob_section]![section_id]));", _
cnnLocal, adOpenDynamic

If I change the [Forms]![frmJob_section]![section_id] segment to just a number (say 288) the code work fine, but for some reason it will not go with the form info. I have confirmed with a mouse roll over that the value of [Forms]![frmJob_section]![section_id])) is set to 288 (at run time)with a break point, yet I still have the error.

Any Ideas ? ? ?
 
Try "SELECT [line_data_id],[section_id], [chk_status] " & _
"FROM section_detail WHERE (((section_id) = '" & [Forms]![frmJob_section]![section_id])) & "'";",
 
Llkhoutx

Thanks for your reply

You might have the right idea but I am still having an issue I know have an Expected end of statement error on the second to last )

"SELECT [line_data_id],[section_id], [chk_status] " & _
"FROM section_detail WHERE (((section_id) = '" & [Forms]![frmJob_section]![section_id])) & "'";",

What gives? I have tried taking out the ) but the issue just moves to the next character.
 
try this statement:

"SELECT [line_data_id],[section_id], [chk_status] " & _
"FROM section_detail WHERE section_id ='" & [Forms]![frmJob_section]![section_id] & "';"
 

Users who are viewing this thread

Back
Top Bottom