PC Review


Reply
Thread Tools Rate Thread

A97 to A2K2 coding difference

 
 
Andrew Gould
Guest
Posts: n/a
 
      16th Jun 2004
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


 
Reply With Quote
 
 
 
 
Van T. Dinh
Guest
Posts: n/a
 
      16th Jun 2004
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.

--
HTH
Van T. Dinh
MVP (Access)


"Andrew Gould" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Alex Dybenko
Guest
Posts: n/a
 
      16th Jun 2004
try also to replace
DoCmd.Close A_FORM, "Complete Class"
with
DoCmd.Close acFORM, "Complete Class"

--
Alex Dybenko (MVP)
http://Alex.Dybenko.com
http://www.PointLtd.com


"Andrew Gould" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>



 
Reply With Quote
 
Peter De Baets
Guest
Posts: n/a
 
      16th Jun 2004
What line of code is highlighted when you get the error?

Peter De Baets
Peter's Software - MS Access Tools for Developers
http://www.peterssoftware.com


"Andrew Gould" <(E-Mail Removed)> wrote in message news:<(E-Mail Removed)>...
> 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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding dates difference in VBA for Access 2003 J. LeRoy Microsoft Access Form Coding 10 3rd Jun 2008 07:08 PM
Steven Lebans A2K2 Question =?Utf-8?B?amFja2xl?= Microsoft Access Form Coding 0 1st Mar 2007 11:25 AM
reference problem A2K2 david epsom dot com dot au Microsoft Access 4 8th Apr 2005 09:24 AM
Faxing wint A2K2 and WinXPPro =?Utf-8?B?V2luc3Rvbg==?= Microsoft Access Reports 1 29th Jun 2004 03:49 AM
Syntax for access window size (in A2k2) =?Utf-8?B?QnJhaW5sb3JkIE1lc29tb3JwaA==?= Microsoft Access Form Coding 0 20th Apr 2004 01:46 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:27 PM.