bit of code not working in new database

Oliver1

Registered User.
Local time
Today, 13:56
Joined
Aug 27, 2004
Messages
10
I am currently running Access 2000 and would lke some help. I don't understand why one pice of code will work one place but not another.
The below piece of code will work in the older legacy databases I have, but if I try and use it in a new database I've just created. I get type mismatch, and when I debug the
Set rst = db.OpenRecordset("calldata")
is highlighted.
Is the below an old way of doing things, so by default does not work in a newly created Access 2000 database, and if so what's the correct way of carrying out the below or if not any ideas why it's not working.
Hope you can help, its driving me mad

Dim db As Database
Set db = CurrentDb
Dim message As String
Dim email As String
Dim rst As Recordset
Set rst = db.OpenRecordset("calldata")

email = rst!PA
rst.MoveNext
Do While Not rst.EOF
email = email & ";" & rst!PA
rst.MoveNext
Loop
rst.Close
 
The code is referencing DAO.

New Access 2k+ dbs reference ADO by default.


Go to the code window.
Tools>references

From the ticked list , disable ADO (Activex Data Objects or something)
Scroll down to microsoft DAO 3.6 objects and tick it.
Click ok and close the window
Debug>Compile


Vince
 
Cool

That works fine now, thanks loads, can get on with some work now.
I would like to know how do I open a recordset using ADO then.
Also which is better ADO or DAO (whats the difference).
 

Users who are viewing this thread

Back
Top Bottom