Make Table Requery After Search

legalhustler

Well-known Member
Joined
Jun 5, 2014
Messages
1,214
Office Version
  1. 365
Platform
  1. Windows
I have a pop up Search Form that looks into a (read only) Table. In the Search Form I type a vendor name and click the binocular button and the Table shows the specific vendor records. I would like the Search Form to requery the Table so when I type a different vendor name (or any other criteria that I have on my Search Form) and click the binocular button the Table is requeried/refreshed instead of me having to close the tabbed Table and reopen it to see the second set of my search results.

Here is the code for Binocular button in my Search Form:

Code:
Private Sub BinocularButton_Click()
DoCmd.OpenQuery "Fiscal Quarter & Cycle Time", acViewNormal
End Sub

Here is the code for the different criteria text boxes in my Search Form:

Code:
Private Sub Command20_Click()
Me.qVendor.Value = ""
Me.qPurchaseOrder.Value = ""
Me.qContractNumber.Value = ""
Me.qContractAction.Value = ""
End Sub

I believe this is pretty simple me.requery.TableName type of code that I need to modify in my Binocular Button. Thanks for the help in advance.
 
Last edited:

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
You mean Requery the Record Source of the Form don't you? Hmm, are those fields in your query? Have you put reference to them on the Criteria line in the query? Perhaps this will help...Microsoft Access tips: Search criteria


Opps.... I meant Make Query requery after search

I want to requery my Query based on my Search form. My search Form searches for data in the Query. When I put the criteria in my search Form it retrieves the data from the Query. While my (small) search Form is still displaying on top of the Query I want to put a different criteria and have the Query find that information.

What I currently do the first time is put my criteria in my search Form and it retrieves the data from my Query, while the search Form is still displaying I put a different criteria and hit the binocular (or find) button but the Query is stagnant based on my last search criteria (this shouldn't be happening). While my search Form is still up, I have to close the Query then hit the find button again then the Query will display the results of my criteria the second time around.
 
Last edited:
Upvote 0
Okay, then please look at the link I posted, it does what you want and no closing and reopening of the query.
 
Upvote 0
Okay, then please look at the link I posted, it does what you want and no closing and reopening of the query.


I got it thanks. I knew the code was pretty simple, just added the following.

Code:
DoCmd.Requery
Me.Refresh
 
Upvote 0

Forum statistics

Threads
1,222,405
Messages
6,165,867
Members
451,989
Latest member
DannyBoy1977

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top