Converting pre-97 code

PaulA

Registered User.
Local time
Today, 05:49
Joined
Jul 17, 2001
Messages
416
I have an old database developed (we think) in a pre-97 version of access. It has been used in 97.

Now we need to convert to Access 2000 and there are multiple compilation errors.

The primary type of error consists of code of which the following is an example:


Set db = DBEngine.Workspaces(0).Databases(0)
Set rst = db.OpenRecordset("TherapyDataBase")

'Stop
Do While Not rst.EOF
' is the client a match?
If Trim(UCase(SaveClientName)) = Trim(UCase(rst.Client)) Then
' got a client match
TypeMatch = False

The syntax "rst.Client" generates an error. The database is full of statements using "rst.".

I am pretty new to programming. How could I convert this old style code to code accepted by A2K?

Thanks
 
The problem you are running into is due to your References.

Access 2000 uses the ADO Recordset (Microsoft Perfered) while 97 back use DAO Recordset (At that time Microsoft Perfered)

Remove the ADO Reference and Add the DAO Reference. This will solve that part.

Then next part is to possibly go about converting from DAO to ADO. (Once your conversion works that is).
 
You need to change the dimension statements for ALL your DAO objects not just Recordset. You also need to change to:
DAO.Database
DAO.QueryDef
etc.
 
Thanks for all your input--

I have adjusted the references and added the dao prefix as suggested.

When referencing a field in the record set, VBA is not recognizing "rst.fieldname". Would changing the syntax to rst("fieldname") solve this problem?

Thanks.
 

Users who are viewing this thread

Back
Top Bottom