Dialog box on parameter query

  • Thread starter Thread starter Kenneth Dupont
  • Start date Start date
K

Kenneth Dupont

I am running a parameter query from a Macro with the click
of a button on a form. The dialog box appears and asks to
enter whatever. If I hit the cancel button on the dialog
box, the HALT dialog box appears which I do not want. I
want to terminate back to the form that has the launch
button. Is there an additional line in the macro or do I
do something to the query itself. my email is
(e-mail address removed). I will check back here or I would
appreciate an eMail. Ken
 
Kenneth said:
I am running a parameter query from a Macro with the click
of a button on a form. The dialog box appears and asks to
enter whatever. If I hit the cancel button on the dialog
box, the HALT dialog box appears which I do not want. I
want to terminate back to the form that has the launch
button. Is there an additional line in the macro or do I
do something to the query itself. my email is
(e-mail address removed). I will check back here or I would
appreciate an eMail. Ken

Using VBA will give you more control over execution flow, allows for
error handling and parameter passing.

It's an extra learning subject, but I suspect it'll turn out worth the
effort.

I assume your query is called yourParameterQuery (substitute as
appropriate) and has exactly one parameter.

* set the onClick property of the button to [Event Procedure] and click
the Build button (the three dots)
* between the Sub ... End Sub, type this VBA code:

dim qd as querydef
dim cArg as string
cArg = inputbox("Your parameter question text")
if cArg<>"" then
set qd=currentdb.querydefs("yourParameterQuery")
qd.parameters(0) = cArg
qd.Execute
set qd=nothing
end if

****
the if ... endif catches the Cancel button.
 
Back
Top