View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default Pass Parameter to Access Query

Al

There's really no easy way to do that. First, why are you running the query
from inside Excel? There may be a better way to do what you are trying to
do.

If you must do it this way, there is one option that I can think of. Remove
the parameter from the Access query and rebuild the SQL of the QueryDef
object to include the cell's value in the criteria.

--
Dick Kusleika
MVP - Excel
Excel Blog - Daily Dose of Excel
www.dicks-blog.com

"Al" wrote in message
...
I'm using the following code to open a query in Microsoft
Access.

Sub Test()
Dim appAccess As New Access.Application

appAccess.OpenCurrentDatabase "c:\reports\test.mdb"
appAccess.DoCmd.OpenQuery "query3"

End Sub

I've made the query, query3 a parameter query and i would
like the query to pick up a parameter value from my Excel
worksheet. How might I do this? Thanks in advance.