Hi, I often have need to run queries in sequence, (sometimes as many as 100 in a row). Obviously, I do not want to manually create a macro to do this. This is what I used to do:
I'd use QueryDefs.Name to drop the query names into a table QTable...
Order QueryName Run
1 Query1 Y
2 Query2 N
3 Query3 Y etc
Then the following function would run them, called thru a macro:
numQueries = DCount("[Order]", QTable)
For x = 1 To numQueries
varx = DLookup("[Query]", QTable, "[Order] = '" & x & "'")
vary = DLookup("[Run]", QTable, "[Order] = '" & x & "'")
StringQry = varx
If vary = -1 Then
DoCmd.OpenQuery StringQry
DoCmd.Echo True, StringQry
End If
Next x
Used to work flawlessly, now all of a sudden (we upgraded to Access2002, where it DID work for a few months) it won't work on some databases anymore (You cancelled the Previous Operation, is the perplexing error message)
Any ideas on how I can do/fix this???????? (thanx)
I'd use QueryDefs.Name to drop the query names into a table QTable...
Order QueryName Run
1 Query1 Y
2 Query2 N
3 Query3 Y etc
Then the following function would run them, called thru a macro:
numQueries = DCount("[Order]", QTable)
For x = 1 To numQueries
varx = DLookup("[Query]", QTable, "[Order] = '" & x & "'")
vary = DLookup("[Run]", QTable, "[Order] = '" & x & "'")
StringQry = varx
If vary = -1 Then
DoCmd.OpenQuery StringQry
DoCmd.Echo True, StringQry
End If
Next x
Used to work flawlessly, now all of a sudden (we upgraded to Access2002, where it DID work for a few months) it won't work on some databases anymore (You cancelled the Previous Operation, is the perplexing error message)
Any ideas on how I can do/fix this???????? (thanx)