Detect command button click on a form.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everyone
I'd like to know if there is a way to detect when a form's command button is clicked(left) so that I can open a query
The reason I want to do this is because I want to open a query based on the information added to the form
the vb I had in mind is this
If Forms![Report Date Range].[Preview] = 1 then ' if the preview button is left clicke
docmd.openquery "openmyquery", , acRea
end i

Thanks for any suggestions or resolutions
Chieko
 
Put your code in the "on click" event of the button.


Chieko Kuroda said:
Hello everyone,
I'd like to know if there is a way to detect when a form's command button
is clicked(left) so that I can open a query.
The reason I want to do this is because I want to open a query based on
the information added to the form.
the vb I had in mind is this:
If Forms![Report Date Range].[Preview] = 1 then ' if the preview button is left clicked
docmd.openquery "openmyquery", , acRead
end if

Thanks for any suggestions or resolutions,
Chieko
 
I use this form as a filter for several reports, so I was hoping that I could detect the command from the report. This would keep the forms to a mininum
Thanks for your help
Chieko
 
Chieko Kuroda said:
I use this form as a filter for several reports, so I was hoping that I
could detect the command from the report. This would keep the forms to a
mininum.
Thanks for your help,
Chieko

The "usual" practice is to open the Form, set your filter critera, and then
press a command button to open the desired Report. Are you trying to do
this the other way around?
 
Back
Top