Passing Parameters From Excel To An Access Query (1 Viewer)

chergh

blah
Local time
Today, 01:21
Joined
Jun 15, 2004
Messages
1,414
Hey folks,

Not sure if this is the best forum but decided to put it here anyway.

I have a Access query that reads:

SELECT bleh
FROM blah
WHERE something > 10

Then in Excel I pull the data across using:

Set qdf = db.QueryDefs(qryName)
Set rs = qdf.OpenRecordset

and paste the data using

ws1.Range("IV1").End(xlToLeft).Offset(0, 2).CopyFromRecordset rs

I now want to change the query so the where statement reads

WHERE something > [amt]

So the question is how do I pass the value for the parameter value for [amt] from excel to access?
 

chergh

blah
Local time
Today, 01:21
Joined
Jun 15, 2004
Messages
1,414
set qdf = db.QueryDefs("MyParameterisedQuery")
qdf.Parameters("ParameterName").Value = "Whatever"

would be what I am looking for
 

Users who are viewing this thread

Top Bottom