--
HTH
Van T. Dinh
MVP (Access)
"kiloez" <kil...@discussions.microsoft.com> wrote in message
news:58DD37C9-08A1-4F04...@microsoft.com...
> 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.
>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.
Dim db as dao.database
Dim strSQL as string
Set db = Currentdb(()
db.QueryDefs("qryYourQuery").SQL = strSQSL
Something like this should do it.
Richard
strSQL = "SELECT * FROM Table1 " & _
" WHERE MyField = " & Me.MyTextBox
qdf.SQL = strSQL
--
HTH
Van T. Dinh
MVP (Access)
"kiloez" <kil...@discussions.microsoft.com> wrote in message
news:9BA73F60-9D4F-415D...@microsoft.com...