Help! Parameter Query via Data Control 
Author Message
 Help! Parameter Query via Data Control

I don't have any problem of opening a parameter query in Access 1.0
using a snapshot or a dynaset. But I could not figure out how to open a  
parameter query using the data control.  My parameter query is a query
that was saved previously in Access and it expects a parameter.  

It works great if I do it using the snapshot:

    Set MyDB = OpenDatabase("c:\data\mydb.mdb", False, True)
    Set MyQuery = MyDB.OpenQueryDef("get_name")        ' query name
    MyQuery![PED CODE] = "NY"                          ' parameter
    Set MySnap = MyQuery.CreateSnapshot()
    While Not MySnap.EOF
    ....

So I tried the same thing using the data control but it never works:

    Data1.DatabaseName = "c:\data\mydb.mdb"
    Data1.RecordSource = "get_name"               ' my query name
    Data1.Filter = "[PED CODE] = " & PEDCODE      ' parameter
    Data1.Refresh
    Data1.recordset.movefirst
    While Not Data1.recordset.EOF
    ...

This one goes into infinite loop.  It never reaches the EOF mark.

Question:  
Can I be able to open a parameter query using the data control and pass a
parameter to it?  If yes, please show me how.

Any other help would be appreciated.



Sat, 13 Jun 1998 03:00:00 GMT  
 Help! Parameter Query via Data Control
Hi Thao

I only speak for VB3.0 pro, I think it's possible in VB4

As far as I know it's not possible to pass a parameter to access when
you're using the Data Control. I replace the parameter query with a
Sqlquery wich I connect to the Data1.Recordsource. That's the only way I
have managed to solve it and the only thing indicated in this newsgroup
except "SKIP THE DC", I like it but I'm not a very good programmer.

Hope it helped
If you find out a way please let me know.

Anders Bjurestig

Quote:

>I don't have any problem of opening a parameter query in Access 1.0
>using a snapshot or a dynaset. But I could not figure out how to open a  
>parameter query using the data control.  My parameter query is a query
>that was saved previously in Access and it expects a parameter.  
>Question:  
>Can I be able to open a parameter query using the data control and pass a
>parameter to it?  If yes, please show me how.



Tue, 16 Jun 1998 03:00:00 GMT  
 Help! Parameter Query via Data Control
Quote:
>>But I could not figure out how to open a  

parameter query using the data control.  

You simply cannot use parameter queries with the data control in VB3.
You can do this in VB4 however.

-- Jim F.



Wed, 17 Jun 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Passing Parameters to stored parameter queries using VB 5's Data Controls

2. HELP with Parameter queries and Data Control

3. Parameter query for Bound Data Control

4. VB4: Parameter query&Data Control?

5. Parameter Queries and Data Controls

6. Using Parameter Queries and Data Controls

7. Parameter Queries and Data controls

8. Data Control and Query Parameters Question

9. Parameter Queries in a VB data control

10. How to bind Parameter Query to Data Control ?

11. Executing Access queries with Data Control and parameter passing

12. Data Control and parameter query

 

 
Powered by phpBB® Forum Software