TransferSpreadsheet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Users want to download data from my database to excel. I would like to use a
sql string that gets created. Is there any way to use a string or string
variable instead of a saved query? If not, haw can I save the string to a
query?
 
Justin,
On this below you can give the new QueryDef a blank name.
SQL="SELECT * FROM Customers"
set qd=db.CreateQueryDef("",SQL)
qd.OpenRecordset

On this one you can assign SQL string to the stored query.
SQL="SELECT * FROM Customers WHERE CustomerID =1"
set qd=db.QueryDefs("qryCustomer")
qd.SQL=SQL
qd.OpenRecordset
 
Craig

Sorry, I'm not very strong in this area. What data type should I set db to?

Thanks for the assistance,
Justin
 

Ask a Question

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.

Ask a Question

Back
Top