old A97 code?

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


0
Andrew
6/16/2004 1:46:13 PM
access.conversion 3038 articles. 0 followers. Follow

1 Replies
870 Views

Similar Articles

[PageSpeed] 31

This database was previously converted from Access 2.0 to Access 97 as
evidenced by the Compatibility Library (Microsoft DAO 2.5/3.5 Compatibility
Library).  This was a 'bridge' program that allowed the old "Access Basic"
code to work with VB.  The differences were small but there are some.

It has been a while, but I believe that the "Table" data object is no longer
supported.  That should be changed to a Recordset object and the OpenTable
method should be change to OpenRecordset
Dim History As DAO.Recordset
Set History = db.OpenRecordset("Class History", dbOpenTable)

also, change the Snapshot object to a recordset object
 Dim Class As DAO.Recordset
 Set Class= db.OpenRecordset("Class Schedule", dbOpenSnapshot)

Also (although I don't see a problem below) VB is pickier about use of the
dot (.) and bang (!).  Several places that Access Basic allowed the dot, VB
required a bang.  In addition, the DoCmd statement did not require a dot in
Access Basic but does in VB:

Access Basic: DoCmd Requery
VB:  DoCmd.Requery

There may be others, but those are the most common.  You'll have to fix all
the compile errors before you can continue.

-- 
--Roger Carlson
  www.rogersaccesslibrary.com
  Reply to: Roger dot Carlson at Spectrum-Health dot Org


"Andrew Gould" <ajgould@iastate.edu> wrote in message
news:e%238gLh6UEHA.3332@tk2msftngp13.phx.gbl...
> 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
>
>


0
Roger
6/16/2004 2:50:18 PM
Reply:

Similar Artilces:

how do i get a macro/code to open a specific switchboard page
hi i have four switchboards (patient, staff, lists, accounts) with patient being default but i need to open the staff switchboard using either a macro or VBA thanks I assume by "switchboard", you are referring to an Access form which is designed to function as a switchboard-type menu. This line in a VBA procedure will open the specified form. DoCmd.OpenForm "staff" There are additional arguments which can be used to control how the form opens. Search Access Help for more details. Where and how you use this, of course, depends and where and how y...

Files in folder Windows.old in Vista
I have installed Ultimate on a Business version and then received the Windows.old folder. I want to delete it but have found same working files in old path than in the new. It appears that Windows updates the working files in both folders. Are they mirrored or copies. I changed the name of one file in old - corresponding file in the new folder received the same name. If I delete files from Windows.old will they be deleted from current folder too? "HBj" <HBj@discussions.microsoft.com> wrote in message news:12D90C20-D766-48D2-AA9C-D0FF7097DEBA@microsoft.com... ...

0x800c013e error code
Tried to search but nothing came up. I'm getting the above error code when trying to open my Outlook Express 6 (w98). It won't let me access my inbox. Any ideas on what I need to do to fix it. Thanks, Lisa S ...

My code not work ===> Case vbNo
I have code that doesn't work in case vbNo and don't know why. Please help.The code works on form BeforeUpdate even but not on my command button click even.It return me Variable not define to the statement Cancel = True Any guidance would be greatly appreciated Thank's Private Sub AddSpec_cmd_Click() On Error GoTo Err_AddSpec_cmd_Click Dim strMessage As String Dim intResponse As Integer intResponse = MsgBox("Is the spec correct?", vbYesNoCancel, "Confirm") Select Case intResponse Case vbYes If IsNull(Me.Model) Then strMess...

office 2007 and old office 2003 excel files
I have a desktop pc with Office 2003 and Vista Home premium system. I am getting a new laptop and am purchasing office 2007 home student to install on it. With the laptop I can access shared files from the desktop. However, all my old files were generated by office 2003. Will the office 2007 be able to access and process these old files? Also, can I uninstall office 2003 from my desktop and install the office 2007 on it and use the old files created by office 2003? Thanks. Carl Yes, Excel 2007 can read 2003 files... You can either convert them to the new version by savi...

Opening docs from old versions
In attempting to open a doc created in an ancient version of Word (for Windows, not DOS), I get this message: "You are attempting to open a file that was created in an earlier version of Microsoft Office. This file type is blocked from opening by your registry policy setting." What is the registry setting I must change to override this and allow the opening? Thanks. -TedMi Hi Ted, I'm pretty sure this is the KB article you need: http://support.microsoft.com/kb/938810 There are both downloadable reg files and instructions for manual editing...

Retrieving/opening Outlook express emails from old drive
Hi all, I recently needed to replace the hard drive in my notebook. The old drive is still operational, so I can now using it as an external hard disc. How can I open to read / and save or import all the email folders in Outlook express from this older disc? I'd like to save all those messages to a backup/archive. Thanks, Shayne. Try posting this in an Outlook Express news group - this is not one of them. Outlook is a part of Microsoft Office and is what this group supports. Outlook Express is a part of Internet Explorer and has its own news groups. You can also find some good Out...

old posts
How can I find a post I made yesterday? Hi, when you open this post, click on your name, it will pop up a window with your information, at the to right click on Recent posts by this user if this helps please click yes, thanks "Eric" wrote: > How can I find a post I made yesterday? I'd use google. Give it enough information (keywords/author/subject): http://groups.google.com/advanced_group_search http://groups.google.com/advanced_group_search?q=group:*Excel*&num=100 Ron de Bruin has an excel addin that you may like: http://www.rondebruin.nl/Google.htm Eric wrote:...

Color Coding cell based on date (over a large range)
I have a "calendar" that I want cells color coded based on a date entered in a reference cell. I've tried it a couple of ways using conditional formatting (which I assume is the correct way to do it), but can't figure out exactly how to accomplish it. I.e., given the following type of spreadsheet entry... A B C D E F G H I J K 1 JANUARY 2 1 2 3 4 5 6 7 8 9 ... 3 _ _ _ _ _ _ _ _ _ (C3 would be Jan 1, D3 would be Jan 2, etc) If a reference cell has Jan 1 in it, then C3 would be highlighte...

Changed a pers folder to "Old Stuff" now can't close/del "Old Stu.
When I installed Outlook I ended up with three "Personal Folders" folders. I was able to delete one of them by changing the name and right clicking on the new name. I changed the name of the 2nd and when I tried to delete it I got the message: "The operation failed. An object could not be found." Has anyone had this problem and if so, did they find a solution? What version of Outlook? Try creating a new mail profile - it sounds like yours is corrupt. -- Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert l...

Outlook gets OLD messages again....
How does this happen? I've got messages coming in from April that I had deleted. May be your provider restored a backup? -- EDV-Service Marchert [Peter Marchert] --------------------------------------- Homepage: http://www.marchert.de Rufnummernformatierung mit EditNumbers Kontakte per Mausklick mit ContactMaker smerf schrieb: > How does this happen? I've got messages coming in from April that I had > deleted. It's 1and1.com.....the girl that answered couldn't do anything but request a sample email from me and promise a call later. This has happened...

How old are you?
I'm trying to work out the age of someone, based on the current date an their date of birth. I've used the YEAR [Year(A1)-Year(B1)] function bu it rounds up? Can anyone help? Thank -- tee ----------------------------------------------------------------------- teeb's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1317 View this thread: http://www.excelforum.com/showthread.php?threadid=51062 Hi teeb With the date of birth in B2 Completed years =IF(B2<=TODAY(),DATEDIF(B2,TODAY(),"Y"),-DATEDIF(TODAY(),B2,"Y")) See also http://www...

how can I get old replaced excel file
I have one A file, suddenly I have go to sav as option & select file B to replace with A I said yes, but my mistake I said yes. Please see how can I get that old A file from back date ? Use the backup copy. If you didn't create a backup last time, make sure that you do next time. In your "Save As" dialogue, "General Options" comes from the Tools option (in Excel 2007). If you didn't create a backup copy yourself, then you are out of luck unless your system (or your IT department if you have one) has created a backup, or unless you sent a cop...

AutoPublish code
Hi, I'm looking for an autopublish product for a customer of mine. I know of one, but I'm trying to create a list of options for my customer, so if you know of one, can you please reply to this post with details. -- Regards, Ben. I've seen a couple folks develop macros to publish all projects. Not sure if that's what you're looking for.... - Andrew Lavinsky Blog: http://blogs.catapultsystems.com/epm > Hi, I'm looking for an autopublish product for a customer of mine. I > know of one, but I'm trying to create a list of options for m...

How do I view old appointmens in my calendar.
I'm trying to view old appointments in my calendar but it only shows activity for the past 10 months. How can I see what I did a year ago or more? Are you using autoarchive to clean up the old appointments? If so, you need to open the archive. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ Outlook Tips by email: mailto:dailytips-subscribe-request@lists.outlooktips.net EMO - a weekly newsletter about Outlook and Exchange: mailto:EMO-NEWSLETTER-SUBSCRIBE-REQUEST@PEACH.EASE.LS...

Color Coding in a Drop Down List
Is there an easy way in MS Excel 2003 to color code the values in a drop down list. Actually not so much in the list itself, but once the value is selected and displayed in the cell. As an example, the drop down list contains "Passed", "Failed", and "Incomplete". Once the selection is made, I would like the background color of the box to be green, read, and yellow respectively. Thanks! Don Look at conditional formatting under format cell value is equal to Passed, then click format and pattern and select colour, click OK now select add and cell value equa...

word keeps changing old date to current date on old documents
I have word documents from weeks ago and when I go back into them the date automatically changes and I no longer know the original date that they were typed. Any help? Press Alt+F9 to display the field code. Edit DATE to read CREATEDATE. Press Alt+F9 again to toggle back and F9 to update. Better yet, change the field in the template on which the documents are based. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "BrittRox" <BrittRox@discussions.microsoft.com> wrote in message news:D9770213-7D10-4C3...

Updating my old Comp.
Hello, I have an old computer, a VPR Matrix 180R, and i want to rip its guts out and put new hardware in. The only problem is i have literally no idea where to begin. I want to get a new motherboard but i dont know what is compatable with this system. My current motherboard specs are; Manufacturer:Intel Corp. Model:D845EBT Version:AAA92334-304 NorthBridge: Intel i845E Rivision E0 CPU: Intel Pentium 4 CPU 1.80 GHz CPU Socket: 478mPGA 5 pci 1 agp slot I want to buy a new motherboard and then a new processor, as well as ram and if i have to a hard drive and a PCI-E gra...

how to get software from old PC to new PC
I have a very old PC running Windows XP and an old version of Office Small Business 2002. Currently I have upgrated to Office Standard 2007. I want to by a new PC running Windows 7 64-bit. I have the original set up disks for Office Small Business 2002 and a couple of upgrade disks. Can I take the disks I have and apply them to the new computer? Sure you can but you might want to run the Win7 upgrade advisor first and verify the Office 2002 is even compatible with Widows 7. "JTC" <JTC@discussions.microsoft.com> wrote in message news:834AB8BF-26F9-4D73-B74...

Need to Hard Code Date
Once the meeting date is typed in on the form (entered into the table) I don't want anyone to be able to change it. I've experimented with different options but they prevent puting in the meeting date on a new record. I'm sure the solution is simple, I just don't know what it is and I need to fix it by Monday. Thanks in advance! How about: Private Sub Form_Current() If IsNull(Me.MeetingDate) Then Me.MeetingDate.Locked = False Else Me.Meetingdate.Locked = True End If End Sub -- There's ALWAYS more than one way to skin a cat! Answers/posts based on...

How to convert a Chinese registry value from within a US code page?
First of all, our Win32 MFC VC++ app is not written in Unicode as it should have been. Given that - it reads uninstall information from the windows Uninstall registry tree and writes it to a report. It writes out the displayname of the application. Normally this is not a problem, but when it encounters a Chinese application name, it displays the name as question marks. I assume this is because the string is in Unicode in the registry, but our app is not Unicode so it can't represent the characters. Unfortunately for the moment, converting this very large app to Unicode is not an o...

Relative vs Absolute References (VBA Code)
Hi, If I'm recording a macro and specify to use relative references, why does the VBA code look as though it is specifying absolute cell references? I.e., ActiveCell.FormulaR1C1 = "Test" ActiveCell.Offset(1,0).Range("A1").Select Why is A1 listed here...considering I'm running this in another part of the worksheet say I42? Thanks Jerry What you're seeing is just a by-product of how Excel records macros. Actually, the Range("A1") part is not needed. So if it bothers you, you can edit your code like this: ActiveCell.FormulaR1C1 = "Test...

Old Money
Hi Im sorry to bother you guys but I have a question re "money". It seems that my "cash acccount" is not included in the overall picture, the balance of this account is not reflected on the "home" page. When I go to "Review your current budget status" page it says I have no income (wages & salary) at all when there clearly is income going into the cash account. The figures relating to the cash account dont seem to influence any totals. Sorry this is a bit hard to understand but its difficult to explain. Hope you can help me. Moose. ...

VB Code to transfer report from Access to Excel
I have a report that I want to transfer to an excel spreadsheet from Access. I need to make this a macro or vb code on a button on a form, but cant seem to find a way to do it. I'd like to use the "Analyize with Excel" button, but cant see how to use it. Thanks in advance for your help. On Mar 22, 11:27 am, "RB" <mcrace...@yahoo.com> wrote:> I have a report that I want to transfer to an excel spreadsheet from Access.> I need to make this a macro or vb code on a button on a form, but cant seem> to find a way to do it. I'd like to use the "Anal...

Reducing the number of lines of code required
I'm trying to create a form for work and I have the following lines o code created within it... I have another 20 checkboxes which wil require similar lines of code. Is there any way to cut down on th total number of lines required (as it will end up being a ridiculou size otherwise)? CheckBox5.Value = False TextBox14.Enabled = False TextBox14.BackColor = RGB(128, 128, 128) CheckBox6.Value = False TextBox15.Enabled = False TextBox15.BackColor = RGB(128, 128, 128) CheckBox7.Value = False TextBox16.Enabled = False TextBox16.BackColor = RGB(128, 128, 128) CheckBox8.Value = False TextBox17.E...