View Full Version : Error with Recordset Open using SQL statment


outside1
07-05-2001, 12:17 PM
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 ? ? ?

llkhoutx
07-05-2001, 12:51 PM
Try "SELECT [line_data_id],[section_id], [chk_status] " & _
"FROM section_detail WHERE (((section_id) = '" & [Forms]![frmJob_section]![section_id])) & "'";",

outside1
07-05-2001, 01:11 PM
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.

joeyreyma
07-05-2001, 04:20 PM
try this statement:

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

outside1
07-06-2001, 06:19 AM
Thanks that did it!