Access query parameters within ADO 
Author Message
 Access query parameters within ADO

I solved this problem by removing the parameter from my Access query and using the Data Environment parameter collection instead. It works like a charm. You have to write the query in the SQL box and use "WHERE MyParameterizedField = ?" Then fill out the Parameter tab with data types, etc. It is important to get the correct data types here. You provide the parameter variable at runtime like so: DataEnvironment.MyQuery strMyParameter.

There may be other ways to execute parameterized queries but this is the only one I know of that works.
HTH
Suzanna

    I have an Access query with 1 parameter.  In my VB app I have an ADO Data Environment with a connection to the Access db, and under the connection, a query command.  On the General tab of command properties the Database Object type is View and the Object Name is the Access query name.  On the Parameters tab VB sets-up everything automatically by referencing Access, EXCEPT FOR "Value".
    I have a data-bound grid whose DataMember is set to the query command.  When I set the command parameter Value to a hard-coded number in the Data Environment the grid is populated correctly; however, what I want to do is substitute a program variable name for the hard-coded value, so at runtime, it will use the variable value.  I can't get past this; I've tried the variable name, the variable name in single quotes, double quotes, etc., and nothing works.  If I can't set this at design time, is there a way to do it a runtime?  Any help is appreciated.

    Thanks - Dana Reed



Sun, 04 Nov 2001 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. MS Access parameter queries using VID and ADO

2. Access parameter query with ADO

3. ADO & Access 2000 parameter queries

4. ADO 2.0 and Access Parameter Queries

5. ADO and Access Multiple Parameter Queries

6. Help! - ADO and Access Parameter Query

7. ADO 2.0 and Access Parameter Queries

8. MS Access parameter queries using VID and ADO

9. MS Access parameter queries using VID and ADO

10. Filter within a parameter query

11. calling parameter query from a parameter query

12. Access to url parameters from within script code

 

 
Powered by phpBB® Forum Software