depends on what kind of query it is.
If you want to run an Action (append, delete, make table, update) then the
fastest method is:
CurrentDb.Execute("QueryNameGoesHere"),dbFailOnError
For many reasons it is better than the DoCmd.RunSQL
To use select queries, you have to use a recordset.
Set rst = CurrentDb.OpenRecordset("QueryNameGoesHere")
Sorry, What I'm tring do is. I have a 10 set of query I would like to open up
in a from a list field. Here what I came up with but it dose not work
rivate Sub RoyaltyReports_Click()
Dim qdfs As QueryDefs
Dim qdf As QueryDef
Dim strQry As String
Set qdfs = CurrentDb.QueryDefs
For Each qdf In qdfs
If Left(qdf.Name, 1) <> "~" Then 'Filter out internal queries
strQry = strQry & qdf.Name & ";"
End If
Next qdf
strQry = Left(strQry, Len(strQry) - 1)
Me.Vendor.RowSource = strQry
Set qdfs = Nothing
Set qdf = Nothing
Hello, What I was tring to do was: I have list of name the I would like to
assoicate the query to selt and run with the assocation, I have something but
it not working.
rivate Sub RoyaltyReports_Click()
Dim qdfs As QueryDefs
Dim qdf As QueryDef
Dim strQry As String
Set qdfs = CurrentDb.QueryDefs
For Each qdf In qdfs
If Left(qdf.Name, 1) <> "~" Then 'Filter out internal queries
strQry = strQry & qdf.Name & ";"
End If
Next qdf
strQry = Left(strQry, Len(strQry) - 1)
Me.Vendor.RowSource = strQry
Set qdfs = Nothing
Set qdf = Nothing
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.