Run Query - criteria in module

  • Thread starter Jack W via AccessMonster.com
  • Start date
J

Jack W via AccessMonster.com

Hi,

I have a button I press to run a query. If I want to filter the records say
for [Date] in the query to =date(), where do I add that in the VBA code to
Open the query with criteria that is not built into the query? (reason being,
then I could make multple buttons with their own criteria rather than
multiple queries...

Private Sub todaysbalances_Click()
On Error GoTo Err_todaysbalances_Click

Dim stDocName As String

stDocName = "qrySearchData"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_todaysbalances_Click:
Exit Sub

Err_todaysbalances_Click:
MsgBox Err.Description
Resume Exit_todaysbalances_Click

End Sub

Any ideas?
 

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