Forms-open query & "On open"

  • Thread starter Thread starter Jennifer
  • Start date Start date
J

Jennifer

There are two things I'm trying to accomplish... The first is: I've created a
command button on my form, which I want to open the query in design view.
Right now, it takes me through the wizard (which is great!) but there is only
an option for running a query not just opening it. Any suggestions? The
second problem is: I have another button on my form so I can select the
Fiscal year and period here. However, I want the form to close when I press
the button to select my time period. They do not have an "On Open" area in
the properties. Any suggestions here?

Thank You, jennifer
 
To open a query in design view form code you simply use this code
DoCmd.OpenQuery "YourQueryName", acViewDesign
To close the form in the same button you use to open the other form add this
code.
DoCmd.Close acForm,"YourFormName"
 
Thanks for your reply Ryan, but we try to stay away from VBA code. I found
that I can just create a macro for that button and the macro will prompt just
to open the query in design view, not run it.
But again, thank you for the help.
Also, I figured the "On Open" problems I was having too.

Thanks All,
Jennifer
 
Back
Top