I have a lot of queries that I would like to run, and they all have the same ending in their name. So, instead of listing tens and tens of queries into DoCmd, is there a way to tell the DoCmd to open all queries that have the same string of letters in their name?
For example, qry1ABC and qry2ABC
Run all queries with a name like "ABC"
This loops through all the queries in the DB and runs only the ones starting with which with a name like ABC:
Public Sub TestMe()
Dim db As DAO.Database
Set db = CurrentDb
Dim qdf As DAO.QueryDef
For Each qdf In db.QueryDefs
Debug.Print qdf.Name
If qdf.Name Like "*ABC*" Then
DoCmd.OpenQuery qdf.Name
End If
Next qdf
End Sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With