refresh or close query

B

BrightIdeas

I run a query from a command button on a form.
If I reselect and click on the button again the underlying data in the
query changes.
However the still open query displays the first selection.

How do I fix this in my vb code?

I am looking for a way to refresh or close the query so the resulting
query reflects the latest selection.

there is a close method but I think it closes the form not the query.
I cant see a refresh method.
and the requery method seems to work on a field and didnt help.


thanks
 
J

John Spencer

I'm guessing that you mean the still open FORM shows the same data.

Why don't you requery the form? If you are doing this from a button on the
form, try

ME.Requery

Otherwise try

FORMS![Your formname].Requery

If you mean you have a SELECT Query open and then you execute an update or
append query, then you need to execute the SELECT query again.

You can add code to your button, to close the query and then open it

DoCmd.Close acQuery, "Your Query Name"
DoCmd.OpenQuery "Your Query Name"
 

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