DAO.Recordset

  • Thread starter Thread starter Mal
  • Start date Start date
M

Mal

I have the following line of code in VB6:

Dim rst As DAO.Recordset

The compiler doesn't like the DAO prefix. Does anyone
know what could be the cause of this.
 
* "Mal said:
I have the following line of code in VB6:

Dim rst As DAO.Recordset

The compiler doesn't like the DAO prefix. Does anyone
know what could be the cause of this.

This is a VB.NET group. Please turn to this group:

<
 
-----Original Message-----
Hi Mal,
Did you set a reference to DAO?
Cor
Thanks for you help Cor. I'm just learning VB. I am
taking this code from a resource book that is explaining
how to create a "dialog box to go to a specific record".
What am I missing to set the reference to DAO? This is the
code they give me:

Private Sub ShowRecord_Click()
'find the selected record, then close the dialog box

Dim rst As DAO.Recordset

'Store the recordset for teh Master Form
Set rst = Forms!Master.RecordsetClone

'Locate the record for the slected account number
rst.Findfirst" "AccountNumber=" " & List0

'Set the form's Bookmark property to move to the record
Forms!Master.Bookmark = rst.Bookmark

'Close the dialog box
DoCmd.Close acForm, "GoToRecordDialog"
End Su
 
Mal,
Regardless of the right newsgroup ...

In your Project/References from the VB6 menu, you need to add a reference to
"Microsoft DAO 3.6 Object Library" (or 3.51 or 2.5 or whatever is registered
on you PC).

hth,
David Straker
 
Hi Mal,

I only know it in VB.net, if you need it in VB6 I thought it was almost the
same.

You open Project, add reference and with VB.net Com, then you search in the
list for the DAO object libary you need and select that..

Cor
 
Hi Mal,

Some confusion in terminology here. The code sample you are following is VB.
But it's VB written to be used in Microsoft Access (most people call it VBA
just to make it clear). You have to be coding inside a Microsoft Access mdb
to be able to use your code. Microsoft Access automatically creates the
reference to DAO for you. You can't use your code sample from VB 6 without
some modification.

David Straker.
 
* "Cor said:
I only know it in VB.net, if you need it in VB6 I thought it was almost the
same.

You open Project, add reference and with VB.net Com, then you search in the
list for the DAO object libary you need and select that..

It's pretty similar, but not topic of this group.
 
Back
Top