Resolution – VBA Error 49 – Bad DLL Calling Convention

So everything in this particular database was working for
a client of mine, until just last night I get notified that
he can’t open the database because of some error.

I was able to view his screen using T.V. and after clicking on
a command button, I would get the following error:

Runtime Error 49 - Bad DLL calling convention

“Error 49 – Bad DLL Calling Convention”

Now, I have been working with Access for over 15 years, so I’m no novice, but I have
never seen this error before. Normally, when I see an error, I can tell myself, “Oh
I’ve seen that before, and last time I did this…”

This error is not a real common one for me. So I started hunting for a solution.

I noticed when I clicked “debug” that the code would break on my “IsLoaded” function.

So I “googled” for “Isloaded” and “Error 49” together.

…and I came across this link “http://w3facility.org/question/runtime-error-49-bad-dll-calling-convention/”

…which deals with Excel VBA.

“OK, maybe it will help”, I thought. “Makes sense”

So I added the following code above the code in the module where my “IsLoaded” function is located:

Private Something
     member = 1
End Enum

So altogether it was:

Private Something
     member = 1
End Enum

Public Function IsLoaded(this_form)
     '...code for function
End Function

…That’s all, AND IT WORKED!


 

Apparently it was some compilation error in the C libraries and this straightened
things out.

Maybe you have had a similar experience. If you have another solution, feel free to
share it.




By the way, if you got or are getting value from the VBA information, please give me a tip, thanks!


These posts may help answer your question too...

How To Parse A Flat File In Excel VBA

In another post I demonstrated how to access a file on your computer using the MS Office Library. Here it is if you don’t know what I’m talking about. In this post, I am going to show you how to access the file and load it into your spreadsheet. I will do the same thing […]

How to pick a file to load In VBA

Picking a file to load in your Microsoft App is a very important skill to know. In this blog post you will see how to do it. First you need to set a reference to the MS office object library From VBE editor –> select Tools > MS office object library (click check mark) Sub […]

How can I interact with other Office applications (Excel) using VBA in Access?

Need to write your Access data or query to an Excel file? Here is the how to do it: Most people are familiar with Excel and know how to use it well (enough), and when you start talking about Access, they get scared off, and don’t know what to do anymore. Well, here you are […]

What Is Microsoft Access Used For?

To those of you who are asking the question of “What is microsoft access used for?” , here is my opinion. I’ve been using this program for well over 15 years, and it’s become fairly easy to deal with. Many people feel that it is hard to work with, but that’s not my experience anymore […]

Previous Post

MS Access Beginner To Advance Propulsion

Next Post

MS Access VBA – How To Add A ‘Select All’ Option To A Combo Box