G
Guest
I have a mod that exports data into excel for me. It runs 49 separate
parameter queries and copies the data directly into excel. Here is an example
of the fist two queries that I am running
-------------------------------------------------
Set qdf = db.QueryDefs("Destination1")
qdf.Parameters("Destination") = varDestCode
Set rs = qdf.OpenRecordset(dbOpenSnapshot)
strRange = "A6:F25"
objSht.Range(strRange).ClearContents
objSht.Range(strRange).CopyFromRecordset rs
Set qdf = db.QueryDefs("Destination2")
qdf.Parameters("Destination") = varDestCode
Set rs = qdf.OpenRecordset(dbOpenSnapshot)
strRange = "A32:F51"
objSht.Range(strRange).ClearContents
objSht.Range(strRange).CopyFromRecordset rs
------------------------------------------------
Is there a better way to do this? Each query is called
Destination1...2....3....49. The parameter is set by a dropdown box on the
form. If you can imagine, doing this 49 times is a bit redundant.
Any ideas?
parameter queries and copies the data directly into excel. Here is an example
of the fist two queries that I am running
-------------------------------------------------
Set qdf = db.QueryDefs("Destination1")
qdf.Parameters("Destination") = varDestCode
Set rs = qdf.OpenRecordset(dbOpenSnapshot)
strRange = "A6:F25"
objSht.Range(strRange).ClearContents
objSht.Range(strRange).CopyFromRecordset rs
Set qdf = db.QueryDefs("Destination2")
qdf.Parameters("Destination") = varDestCode
Set rs = qdf.OpenRecordset(dbOpenSnapshot)
strRange = "A32:F51"
objSht.Range(strRange).ClearContents
objSht.Range(strRange).CopyFromRecordset rs
------------------------------------------------
Is there a better way to do this? Each query is called
Destination1...2....3....49. The parameter is set by a dropdown box on the
form. If you can imagine, doing this 49 times is a bit redundant.
Any ideas?