Perhaps you could supply the parameter like this:
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Set db = CurrentDb()
Set qdf = db.Querydefs("Query1")
qdf.Parameters("[Forms].[Form1].[Text0]") = [Forms].[Form1].[Text0]
qdf.Execute, dbFailOnError
--
Allen Browne - Microsoft MVP. Perth, Western Australia
Reply to group, rather than allenbrowne at mvps dot org.
See:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
My query has perameters that are entered by the user (which date do
they want to change to which date?) so this isn't going to work for
me. I tried, but the code can't find the perameters. I tried using my
normal code (with warnings turned off)and then using the second line
in this example to report the number of records involved:
MsgBox DBEngine(0)(0).RecordsAffected & " record(s) affected."
But it reports 0 no matter the results. Is there a way with my current
code which turns the warnings off, to at least report the number of
records affected?
Code:
Private Sub DateOnly_Click()
On Error GoTo Err_DateOnly_Click
Dim stDocName As String
DoCmd.Close
stDocName = "CallBackQuickChange (Date Only)"
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
MsgBox DBEngine(0)(0).RecordsAffected & " record(s) affected."
Exit_DateOnly_Click:
Exit Sub
Err_DateOnly_Click:
MsgBox Err.Description
Resume Exit_DateOnly_Click
End Sub
magmike