G
Guest
I am extremely close on getting this working but stuck on one thing. I used
the excel export code talked about through this community to take info in my
query and export it to excel. One of my problems however was that I have 24
parameter queries that have to run...the issue is that it prompts the user 24
times for my Destination field.
Anyways, to solve this I built a form that would prompt the user once and
pass the variable into my excelExport() function. This would call all 24
queries and pass the variable into each query using the following:
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As Recordset
Dim....the rest of my variables
....All my excel export stuff
Set db = CurrentDB
Set qdf = db.QueryDefs("My Query Name")
qdf.parameters("My Query Parameter") = varDestCode
**********************************
Set rs = db.OpenRecordset("My Query Name", dbReadOnly)
strRange = "A615"
objSht.Range(strRange).CopyFromRecordset rs
**** - this is where I am not sure. after I set the parameter = to the
variable passed in through my from. How do I then set recordset = my query
(w/my parameter set to my variable)???
the excel export code talked about through this community to take info in my
query and export it to excel. One of my problems however was that I have 24
parameter queries that have to run...the issue is that it prompts the user 24
times for my Destination field.
Anyways, to solve this I built a form that would prompt the user once and
pass the variable into my excelExport() function. This would call all 24
queries and pass the variable into each query using the following:
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim rs As Recordset
Dim....the rest of my variables
....All my excel export stuff
Set db = CurrentDB
Set qdf = db.QueryDefs("My Query Name")
qdf.parameters("My Query Parameter") = varDestCode
**********************************
Set rs = db.OpenRecordset("My Query Name", dbReadOnly)
strRange = "A615"
objSht.Range(strRange).CopyFromRecordset rs
**** - this is where I am not sure. after I set the parameter = to the
variable passed in through my from. How do I then set recordset = my query
(w/my parameter set to my variable)???