Simplest way it to just create the query string on the fly and execute it:
strSQL = "UPDATE ... WHERE SomeField = " & Forms!MyForm!MyTextBox & ";"
dbEngine(0)(0).Execute strSQL, dbFailOnError
Alternatively, you can supply the Parameter for the QueryDef, and execute
that:
Dim qdf As DAO.QueryDef
Set qdf = db.QueryDefs("MyQuery")
qdf.Parameters("Forms!MyForm!MyTextBox") = Forms!MyForm!MyTextBox
....
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"D-Zyl" <d_*****@hotmail.com> wrote in message
news:ef**************************@posting.google.c om...
I wanna execute a query with one parameter from MS VBA.
the trouble is that the parameter is a control in a form.
and I still don't know what is the code I need...