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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Obtein records from select statment....

Status
Not open for further replies.

Diogo

Technical User
Mar 22, 2001
143
PT
I would like to know how i can to obtein records of a query to a datacontrol.
I try

Private Sub Form_Load()
Dim db As Database
Dim Rs As Recordset
Set db = OpenDatabase(App.Path & "\xpto.MDB")
Set Rs = db.OpenRecordset("SELECT cod_cli, nome FROM Tabela1;")
Set Data1.Recordset = Rs
End Sub

But it gives an error.
Thanks by the help.
DR
 
Dear DR

To the best of my knowledge, runtime binding of data is not possible in DAO. You better use ADO data control for that purpose.
Regards.

Irfan Ahmed.
 
This should do the trick for you. Instead of using your Recordset object (rs), use your database object (db):

Set Data1.Recordset = db.OpenRecordset("SELECT cod_cli, nome FROM Tabela1;")
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top