krymat
Technical User
- Jul 25, 2000
- 105
Is there a way I can programmatically compile all of my queries.
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Sub RunAllSELECTQueries()
'Runs all Select queries in the database
'Note: You will still be prompted for query parameters,
and will still be able to see the prompts.
'MS-Access version: 97
Dim qry As QueryDef
'turn off display; speeds execution
Application.Echo False, "Running Queries..."
For Each qry In CurrentDb.QueryDefs
If (qry.Type = dbQSelect) Then
'open the query
DoCmd.OpenQuery qry.Name, acViewNormal, acEdit
'close the query, saving it
DoCmd.Close acQuery, qry.Name, acSaveYes
End If
Next qry
Application.Echo True, "Done Running Queries"
MsgBox "All Done Running Queries!"
End Sub
Constant Query type
dbQAction Action
dbQAppend Append
dbQCompound Compound
dbQCrosstab Crosstab
dbQDDL Data-definition
dbQDelete Delete
dbQMakeTable Make-table
dbQProcedure Procedure (ODBCDirect workspaces only)
dbQSelect Select
dbQSetOperation Union
dbQSPTBulk Used with dbQSQLPassThrough to specify a query that doesn't return records (Microsoft Jet workspaces only).
dbQSQLPassThrough Pass-through (Microsoft Jet workspaces only)
dbQUpdate Update