Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   TechHelp   Forums   Help   Contact   Merch   Join   Order   Logon  
 
Back to Access Developer Forum    Comments List
Upload Images   @Reply   Bookmark    Link   Email   Next Unseen 
code from mdb error
Gary Becker 
     
2 years ago
With the discussion of an accounting database, I tried opening an accounting database (.mdb) I made and used about 20 years ago. Probably using Access 2000 or 2003. Now when I try to open it with Access 365, the Open event of the main form causes an error. To me the code looks okay. Is there an issue with old Access programs and DAO and ADO database types?
Gary Becker OP  @Reply  
     
2 years ago

Kevin Robertson  @Reply  
          
2 years ago
What is the error message? "causes an error" tells us nothing.
Gary Becker OP  @Reply  
     
2 years ago
Here is the error message.
Gary Becker OP  @Reply  
     
2 years ago

Gary Becker OP  @Reply  
     
2 years ago

Gary Becker OP  @Reply  
     
2 years ago
When you click okay, it opens up in the code editor window with the Open event high-lighted.
Richard Rost  @Reply  
          
2 years ago
OK. Compact & Repair your database. Then Compile it and try again.
Kevin Robertson  @Reply  
          
2 years ago
You could also try going to File --- Save As and saving the database as a .accdb file.
Does the same error appear?
Gary Becker OP  @Reply  
     
2 years ago
So, I hadn't thought of the compact and repair option, yet. I tried saving it as an .accdb file. I got to the point where it asked if I wanted to delete all the VBA code. And I did that after making a backup. Then I copied in the Open even code and got an "User-defined type not defined" error that stopped on Dim db as Database. So I Googled it and it said I needed to make sure the DAO reference was turned on. But that gave me an error loading that in the Reference library. So, I created a new BLANK database, then I imported ALL of the old database objects. And then it works. At least the forms open and the code seems to work. I can run Debug & Compile with no errors. So, I think it was something between the old Access format and the new Access 365 that was giving issues. And my experience with Access. Sometimes the code it stops on and/or the error it suggests isn't always what is causing the problem.
Richard Rost  @Reply  
          
2 years ago
Yes, that's what I was going to suggest. You should not need a reference to DAO in the newest versions of Access. That was an old problem when they switched to ADO as the default. I would create a brand new database file like you have and then import all of the objects into that.
Thomas Gonder  @Reply  
      
2 years ago
Not to knock Kevin's comment, ""causes an error" tells us nothing."
But the MS error messages didn't help much either.
Bahahahaha
Richard Rost  @Reply  
          
2 years ago
Yeah, but at least seeing the meaningless dialog that MS gives us is better than nothing. ;)
Thomas Gonder  @Reply  
      
2 years ago
@ Richard, True. Now we know Gary wasn't making it all up.

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Access Developer Forum.
 

Next Unseen

 
New Feature: Comment Live View
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2026 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 5/2/2026 10:04:53 AM. PLT: 0s