Help with hiding/showing forms

K

Katie

I have some code attached to a button on a form that runs
a query, hides the form and then tries to show another
form. It hides the first form, displays the result of the
query but doesn't show the second form. What am I doing
wrong?

Also how do I stop the query result displaying?

DoCmd.OpenQuery "QueryAv"

' 'Hide availability form
Forms![SINGLE BOOKING AVAILABILITY].Visible = False
' 'Open the detail form
DoCmd.OpenForm "SINGLE BOOKING DETAIL"
' '
Forms![SINGLE BOOKING DETAIL].Visible = True
 
B

Bill Taylor

Questions:
What does the query run for? is it an update or append query. By running a
query from code it will display the query results. You would need to close
the query before doing anything else, as an open query will stop all
subsequent code.
 
K

Kate

The query is a select. How do I close the query?

Thanks
-----Original Message-----
Questions:
What does the query run for? is it an update or append query. By running a
query from code it will display the query results. You would need to close
the query before doing anything else, as an open query will stop all
subsequent code.
I have some code attached to a button on a form that runs
a query, hides the form and then tries to show another
form. It hides the first form, displays the result of the
query but doesn't show the second form. What am I doing
wrong?

Also how do I stop the query result displaying?

DoCmd.OpenQuery "QueryAv"

' 'Hide availability form
Forms![SINGLE BOOKING AVAILABILITY].Visible = False
' 'Open the detail form
DoCmd.OpenForm "SINGLE BOOKING DETAIL"
' '
Forms![SINGLE BOOKING DETAIL].Visible = True


.
 

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