Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On Click if query is open Requery?

Status
Not open for further replies.

BillieBurgess

Technical User
Jul 2, 2002
36
US
Hi,
I have a problem; I have a form that explains how to import SerialNumber Scan sheets, which are scanned in under a PO Number into access. On this form, I have an On Click event that says:
Code:
Private Sub Label13_Click()
DoCmd.OpenQuery "QueryListPurchaseOrdersStore10", acViewNormal, acReadOnly
DoCmd.OpenQuery "QueryListPurchaseOrdersStore68", acViewNormal, acReadOnly
End Sub
My Boss clicks the label the query opens he imports a PO not listed on the query, clicks the label and comes and gets me because the query does not show the PO he just imported and he thinks the PO did not import. I have told him repeatedly that he needs to close the query and reopen it, but he still does the above. Is there a way I can write a code that says?
Code:
If "queryName" is open then
docmd.requery "queryName"
I have look in the help file in access and scrolled through some previous questions but have not seen an answer.
Any help would be appreciated.
Billie
 
Have you tried closing and reopening
DoCmd.Close acQuery, "QueryListPurchaseOrdersStore10"
DoCmd.OpenQuery "QueryListPurchaseOrdersStore10", acViewNormal, acReadOnly


Duane
MS Access MVP
[green]Ask a great question, get a great answer.[/green]
[red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
[blue]Ask me about my grandson, get a grand answer.[/blue]
 
That just never occurred to me I was so sure it had to be something complicated.
Thank you so much
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top