>I need to be able to build a SQL string dynamically to pass to a querydef.
>The string will be based on values chosen from a listbox control and/or other
>controls on a form. Any help would be greatly appreciated. Still learning.
Thanks for the replies so far. I know how to pass the SQL string once it's
built, the problem is building the string dynamically so that for each value
chosen from a given control on a form the SQL string produces a different SQL
string to pass.
> >I need to be able to build a SQL string dynamically to pass to a querydef.
> >The string will be based on values chosen from a listbox control and/or other
[quoted text clipped - 10 lines]
>
> Richard
Van T. Dinh - 03 May 2005 22:55 GMT
Not sure whether there is a question in your post but you can code something
like:
strSQL = "SELECT * FROM Table1 " & _
" WHERE MyField = " & Me.MyTextBox
qdf.SQL = strSQL

Signature
HTH
Van T. Dinh
MVP (Access)
> Thanks for the replies so far. I know how to pass the SQL string once it's
> built, the problem is building the string dynamically so that for each value
> chosen from a given control on a form the SQL string produces a different SQL
> string to pass.