View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
matelot matelot is offline
external usenet poster
 
Posts: 72
Default Using excel to access MS Access saved query

I use the following code to open Access db and run a sql.
set dbs=opendatabase(dbname)
set qry= dbs.createquerydef("queryname")
qry.sql="select name from customers"
set rst = qry.openrecordset()
Activesheet.range("A1").copyfromrecordset rst

It's working fine. However, I have multiple saved queries in MS Access that
I would like to access from Excel VBA. I tried replacing "queryname" to the
saved query name and it's not working. Am I missing something?

Thanks