Forms-open query & "On open"

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
 
R

Ryan

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"
 
J

Jennifer

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top