How to bind Parameter Query to Data Control ? 
Author Message
 How to bind Parameter Query to Data Control ?

Does anybody know how to bind a parameter query to a data control?
I'm trying to use the following code:

    Dim Db As Database, Q As QueryDef, Ds As Dynaset
    Dim DbName As String, SQL As String

    DbName = "MYDB.MDB"
    Set Db = OpenDatabase(DbName)

    ' Create query
    SQL = "PARAMETERS [Country Name] Text;"
    SQL = SQL & " SELECT * FROM Cntr WHERE((Cntr.country=[Country Name]))"
    Set Q = Db.CreateQueryDef("ParamQ")
    Q.SQL = SQL

    Q![Country Name] = "Austria"
    Set Ds = Q.CreateDynaset()      'This works

    Data1.DatabaseName = DbName
    Data1.RecordSource = Q
    Data1.Refresh                   'And here I get an error message:
                                    ' " 1 parameters were expected
                                    ' but only 0 were supplied "

Thanks in advance,
        Yuri.



Fri, 19 Dec 1997 03:00:00 GMT  
 How to bind Parameter Query to Data Control ?

Quote:

>Does anybody know how to bind a parameter query to a data control?
>I'm trying to use the following code:

>    Dim Db As Database, Q As QueryDef, Ds As Dynaset
>    Dim DbName As String, SQL As String

>    DbName = "MYDB.MDB"
>    Set Db = OpenDatabase(DbName)

>    ' Create query
>    SQL = "PARAMETERS [Country Name] Text;"
>    SQL = SQL & " SELECT * FROM Cntr WHERE((Cntr.country=[Country
Name]))"
>    Set Q = Db.CreateQueryDef("ParamQ")
>    Q.SQL = SQL

>    Q![Country Name] = "Austria"
>    Set Ds = Q.CreateDynaset()      'This works

>    Data1.DatabaseName = DbName
>    Data1.RecordSource = Q
>    Data1.Refresh                   'And here I get an error message:
>                                    ' " 1 parameters were expected
>                                    ' but only 0 were supplied "

>Thanks in advance,
>        Yuri.

You simply cannot.  This is one the greatest acknowledged shortcomings
of the data control.


Fri, 19 Dec 1997 03:00:00 GMT  
 How to bind Parameter Query to Data Control ?

Subject: Re: How to bind Parameter Query to Data Control ?

Quote:
>Does anybody know how to bind a parameter query to a data control?
>I'm trying to use the following code:

     Cannot do it.

Quote:
>    Dim Db As Database, Q As QueryDef, Ds As Dynaset
>    Dim DbName As String, SQL As String

>    DbName = "MYDB.MDB"
>    Set Db = OpenDatabase(DbName)

>    ' Create query
>    SQL = "PARAMETERS [Country Name] Text;"
>    SQL = SQL & " SELECT * FROM Cntr WHERE((Cntr.country=[Country Name]))"
>    Set Q = Db.CreateQueryDef("ParamQ")
>    Q.SQL = SQL

>    Q![Country Name] = "Austria"
>    Set Ds = Q.CreateDynaset()      'This works

>    Data1.DatabaseName = DbName
>    Data1.RecordSource = Q
>    Data1.RecordSource = Q

     This needs to be a
     SET Data1.RecordSource = Q
     which of course is impossible because it is a property, not a variable.

     Just rack it up to another SEVERE thing that M$ overlooked.

Quote:
>    Data1.Refresh                   'And here I get an error message:

_
"640K ought to be enough for anybody." (Bill Gates, 1981)
QWicKeSST - The ultimate database QWK reader, and NO limits. #BLYGJOMK
Special Compile: 1.008A (Alpha)

'[1;35;40m-=> Delphi Internet Jet SST v3.013A (Alpha) - (C) PBE



Tue, 23 Dec 1997 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. How to bind Parameter Query to Data Control ?

2. Parameter query for Bound Data Control

3. Controls bound to a Data Environment Parameter query

4. How do I create a query then use data bound controls on the query

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

6. Data-bound Masked Edit makes all data-bound controls not display data

7. Parameter query for Bound control

8. Bound Controls and Parameter queries

9. Bound Controls Using Parameter Query

10. Data-Bound Vs. Non-Data-Bound Controls

11. Data-Bound Vs. Non-Data-Bound Controls

12. Data-Bound Vs. Non-Data-Bound Controls

 

 
Powered by phpBB® Forum Software