Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter in Access query automation

Status
Not open for further replies.

Axoliien

Programmer
Aug 19, 2003
166
US
I am revamping some older code to work with some mail merge automation I set up between MS Access and MS Word, and all works great except one single query. One of the automation functions I designed allows the programmer to pass the name of an access query to the function, which in turn opens MS Word and allows word to connect to the database to receive the query results. The query that is not working is retrieving a value from a hidden form, and I know there is a way to instead pass the value as a parameter to the access query. I like to stick to SQL Server Stored Procedures, so I don't recall how to do this.

Code:
SELECT Column1, Column2
FROM tbl_Table
WHERE (Column1 = [Forms]![Hidden Codes]![cr code])

When this is run using Access there is no issue, however when run through automation the parameter is not recognized. Can I instead pass the value? Any help is appreciated, I just need an example.

Thanks!
 
You have to play with the Parameters collection of the QueryDef object.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top