A97 to A2K2 coding difference

A

Andrew Gould

I just recently converted a database from A97 to A2K2. I keep getting the
error, "User-defined type not defined". I've check the references and the
old database when opened in 97 lists:

-VBA
-MSAccess 8.0 Object Library
-Microsoft DAO 2.5/3.5 Compatibility Library
-utility
After importing all tables, forms, ect into an A2K2 new database I attempted
to match the references as close as possible to:

-VBA
-MSAccess 10.0 Object Library
-MS DAO 3.6 Object Library
I'm still getting that same error all over the place. I looked at the code
and it looked a little old but wasn't for sure. Here is the part of the
code that keeps giving me problems, can someone please tell me if the code
needs to be redone or is it something else.

On Error GoTo Err_Complete_Class
Dim db As Database
Dim History As Table
Dim Class As Snapshot
Dim CCount As Control
Dim TotEnroll As Control
Set TotEnroll = Me![*Complete Class].Form![Total Enrolled]
Set CCount = Forms![Complete Class]![Class Counter]
Set db = CurrentDb()
Set Class = db.CreateSnapshot("Class Schedule")
Set History = db.OpenTable("Class History")

If Me![Status] <> 0 Then
MsgBox "This Class Has Already Been Closed Or Canceled.", 0, "ADP
Continuing Education"
Else

Class.FindFirst "[Class Counter] = " & CCount

For I = 1 To TotEnroll
History.AddNew
History("Date") = Me![Date 1]
History("Student ID") = Class("Student ID")
History("Class ID") = Me![Class ID]
History("Instructor") = Me![Instructor]
History("Blue Tag") = Class("Blue Tag")
History.Update
Class.FindNext "[Class Counter] = " & CCount
Next
Me![Status] = 1
History.Close
DoCmd.Close A_FORM, "Complete Class"
End If
 
V

Van T. Dinh

It looks to me that your code was written in version earlier than A97,
perhaps even Access 2.

The "Table" Object in your code need to be replaced by Recordset. The
OpenTable (and CreateSnapshot???) is to be replaced by OpenRecordset. I am
sure there are other bits you will need to modify.

Depending on how much coding you have in the database and how familiar you
are with VBA, it may take you some time to fix the codes. If it is an
important database, it may be better to get an Access programmer in your
area to do the work properly for you.
 
A

Alex Dybenko

try also to replace
DoCmd.Close A_FORM, "Complete Class"
with
DoCmd.Close acFORM, "Complete Class"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top