General discussion

Locked

Passing an parameter to a Query in access

By bop_zw ·
I have a query in MS-Access which when run prompts for a parameter and then copies data from TableA to A Temp Table.
As I need the Query to run more than once how do I pass a parameter once or how do I do this using code?

Thanks

Brian

This conversation is currently closed to new comments.

1 total post (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Passing Parameters

by radobson In reply to Passing an parameter to a ...

There are a couple of methods.

1. Build the SQL of the query with the parameter(s) in the text, then execute that. [ "Select * From TableName Where Field1 = '" & strField1Parameter & "'"]

2. Use ADO to and the Parameters collection.

Depending on the situation I'll use either. 1 is good for an Access only environment. 2. Is probably better for an MSDE or SQL Server environment.

The MSDN site at http://msdn.microsoft.com can provide a complete reference for ADO.

Back to Software Forum
1 total post (Page 1 of 1)  

Related Discussions

Related Forums