PDA

Click to See Complete Forum and Search --> : Passing variables from forms to sql view criteria


jottiwell
Aug 24th, 2000, 09:43 AM
Hi,

I'm just starting out trying to convert an access database to an Access Project from end and SQL server back end. I'm having trouble with my views.

In Access I have many forms which contain lists, these lists pull information from tables based on criteria that the users choose from drop down lists on the same form. Therefore the sql would be something like ( simple example )

"Select field1, field2 from [orders] where [orders][customerid] = " & forms![check customers]![custlist].column(0) & "'"


What I can't figure out is how to put the variable from the form in the view criteria, I presume this is possible, when I try a view criteria '= forms![formname]![controlname]' I get a message reporting that SQL can't parse the query as the string above cannot be found as a column in a table.

Please help, I've figure how to pass parameters to stored procedures in code, but can't figure figure out how to pass it a parameter if it's a named source in the rowsource property of a list.

Thanks

Jottiwell