Solved "Error in loading DLL" when adding reference to DAO (1 Viewer)

CarlSeil

New member
Local time
Today, 09:50
Joined
Nov 30, 2020
Messages
14
Using Access 365. Created new accdb file. Have old code that I need to re-use that uses DAO. When I attempt to run it, it tells me "User-defined type not defined." Aha, this usually happens when I am missing references. Of course, I open up the references and since it's a new accdb file, it's pretty bare bones. And a reference to DAO is not checked. I attempt to add DAO "Microsoft DAO 3.6 Object Library" and it says "Error in loading DLL."

Do I need to click on "Browse" and find the correct DLL on my own or do I need to just register it somehow then it will find it?

My old mdb file I am grabbing this code from works fine. I'd rather not reconfigure this for ADO because I'm really not that great with either.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:50
Joined
Oct 29, 2018
Messages
21,358
Hi. With newer Access versions, a reference to the DAO 3.6 library is usually not needed. Do you see a reference to Microsoft Access Database Engine? If not, try adding it.
 

CarlSeil

New member
Local time
Today, 09:50
Joined
Nov 30, 2020
Messages
14
No, I don't "Microsoft Access Database Engine" listed.
 

CarlSeil

New member
Local time
Today, 09:50
Joined
Nov 30, 2020
Messages
14
Nope, what about "Microsoft Data Access Components Installed Version"?
 

CarlSeil

New member
Local time
Today, 09:50
Joined
Nov 30, 2020
Messages
14
It might say something more like "Microsoft 16.0 Access Database Engine Object Library."

Is "Microsoft 16.0 Access Object Library" it? it is already present and checked.

Aha! Found it. It's called "Microsoft Office 16.0 Access database engine Object Library." That got me past that.

Next thing that seems to be an issue is I am using MB_iconstop which seems to be referenced in user32.dll, but I cannot find any reference in the old mdb file that pulls that in. Other than the DAO reference and Microsoft Excel 16.0 Object Library, I'm referencing the same in both of them (other than the Microsoft Office 16.0 Access database engine Object Library, which I just added in place of the DAO 3.6 reference).

That said, this one is less critical as I can probably re-write the alert dialogs that use it pretty quickly.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:50
Joined
Oct 29, 2018
Messages
21,358
Is "Microsoft 16.0 Access Object Library" it? it is already present and checked.

Aha! Found it. It's called "Microsoft Office 16.0 Access database engine Object Library." That got me past that.

Next thing that seems to be an issue is I am using MB_iconstop which seems to be referenced in user32.dll, but I cannot find any reference in the old mdb file that pulls that in. Other than the DAO reference and Microsoft Excel 16.0 Object Library, I'm referencing the same in both of them (other than the Microsoft Office 16.0 Access database engine Object Library, which I just added in place of the DAO 3.6 reference).

That said, this one is less critical as I can probably re-write the alert dialogs that use it pretty quickly.
Hi. Glad to hear you got it sorted out (somewhat). Good luck with your project.
 

CarlSeil

New member
Local time
Today, 09:50
Joined
Nov 30, 2020
Messages
14
There's some sort of wrapper function for all of the message boxes in that section, and I don't recall writing that. I was able to do a search-and-replace over that section, simplifying the error message boxes and get it to work without the reference to MB_iconstop bit. I do remember using alternative icons a while back, but this message box wrapper was something that I'm 99% positive I didn't write. I'm not even sure that the MB_iconstop was the issue. But it didn't take that long to create new message boxes, as they were just UI error checking on the fields of the entry form, of the type "You didn't fill in blah blah blah." In fact, since it was a wrapper function, it functions exactly the same, even the icon looks the same. <shrug>
 

theDBguy

I’m here to help
Staff member
Local time
Today, 07:50
Joined
Oct 29, 2018
Messages
21,358
There's some sort of wrapper function for all of the message boxes in that section, and I don't recall writing that. I was able to do a search-and-replace over that section, simplifying the error message boxes and get it to work without the reference to MB_iconstop bit. I do remember using alternative icons a while back, but this message box wrapper was something that I'm 99% positive I didn't write. I'm not even sure that the MB_iconstop was the issue. But it didn't take that long to create new message boxes, as they were just UI error checking on the fields of the entry form, of the type "You didn't fill in blah blah blah." In fact, since it was a wrapper function, it functions exactly the same, even the icon looks the same. <shrug>
Good work!
 

Users who are viewing this thread

Top Bottom