Possible answer to Err 49: Bad DLL calling convention 
Author Message
 Possible answer to Err 49: Bad DLL calling convention

For the record:

I've had an elusive error # 49: "Bad DLL calling convention."  Couldn't
trace it to its offending code line as usual.

A Google search turned up a helpful thread from October 1999 in this
newsgroup, which I paste in below.

I followed the advice of Wojtek Korycki (below), which didn't work.
However, when I did a decompile (using command line switch) then recompiled,
it did work.

So, problem fixed, this time, by doing a decompile, then recompiling.

I am running Access 2002 using Access 2002 file format, under Windows XP
Professional.

Hope this will be helpful for someone else.

Mark Hammer
Lake Oswego, Oregon

================

Subject: Access200 - Error 49: "Bad DLL calling..."

Newsgroups: microsoft.public.access.modulesdaovba

View this article only

Date: 1999/10/08

From time to time I get error 49: "Bad DLL calling convention" for no

apparent reason. I figured that if I comment out the code where the error

occurs, compile, then uncomment that code, and recompile again - that fixes

the problem (at least for a while).

Any idea why the error 49 occurs and how to avoid it?

(another Access bug?)

Woj

Message 2 in thread


Subject: Re: Access200 - Error 49: "Bad DLL calling..."

Newsgroups: microsoft.public.access.modulesdaovba

View this article only

Date: 1999/10/08

I have seeen this fairly regularly.... it is coming from

inside VBE. I do not know of a workaround, but I have seen

it in both Excel and Access.

--

MichKa



Thu, 11 Nov 2004 02:03:53 GMT  
 Possible answer to Err 49: Bad DLL calling convention
Mark,

can you identify any specific circumstances leading to the
error? (opening a certain form, running certain code, ...)



Fri, 12 Nov 2004 22:22:08 GMT  
 Possible answer to Err 49: Bad DLL calling convention
Hi Mark,

The error you are receiving  error # 49: "Bad DLL calling convention" is
often caused by incorrectly omitting or including the ByVal keyword
from the Declare statement. This error can also be caused if the wrong
parameters are passed.

Text from Article:Q142138

Bad DLL calling convention (Error 49)
-------------------------------------

Your program is calling a routine in a dynamic-link library (DLL) that
either is
being passed the wrong type or number of arguments or does not use the
Pascal
calling convention. Make sure that the arguments passed to the DLL routine
exactly match the arguments expected by the routine. If the DLL routine
expects
arguments by value, then make sure ByVal is specified for those arguments
in the
declaration for the routine.

I hope that this is helpful.

Thank you for working with Microsoft Developer Support for Access,

Jeff MacLeod, MCP
Microsoft Technical Support        

Of course, this posting wouldnt be complete without a nice, juicy
disclaimer from our lawyers:? This posting is provided AS IS
with no warranties, and confers no rights. You assume all risk
for your use. ? 2001 Microsoft Corporation. All rights reserved.



Sat, 13 Nov 2004 06:43:25 GMT  
 Possible answer to Err 49: Bad DLL calling convention

Quote:

>The error you are receiving  error # 49: "Bad DLL calling convention" is
>often caused by incorrectly omitting or including the ByVal keyword
>from the Declare statement. This error can also be caused if the wrong
>parameters are passed.

Jeff

However Mark specifically stated "Couldn't trace it to its offending
code line as usual."  Surely if it was a declare statement problem the
VBA compiler would highlight the line of code in question.

Tony
--
Tony Toews, Microsoft Access MVP
   Please respond only in the newsgroups so that others can
read the entire thread of messages.
   Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm



Sat, 13 Nov 2004 11:19:32 GMT  
 Possible answer to Err 49: Bad DLL calling convention
Hi Mark and Tony,

The fact that all you had to do is recompile would indicate that code did
not need to be changed in order to get it to work so, as Tony has pointed
out, an invalid declaration is not likely the cause in this case.

From the description of the issue, I would suspect that the VBA Project may
have become damaged and the recompile recreated the project. Access 2000
and 2002 have a significantly different storage mechanism for compiled code
than we used in Access 97 and before. In essence, what was saved in
individual locations is now all lumped together in the VBA Project,
affectionately referred to as the "blob," and can be quite large in size.
For a description of what has changed and why, please see article:

Q287603 - ACC2002: Saving Objects in DB Slower Than in Earlier Versions

    http://support.microsoft.com/support/kb/articles/q287/6/03.asp

If the VBA Project actually did get damaged, you may want to take a look at
the following article which describes how to minimize the risk of
corrupting the database file.

Q303528 - HOW TO: Keep a Jet 4.0 Database in Top Working Condition

    http://support.microsoft.com/support/kb/articles/q303/5/28.asp

I hope this helps! If you have additional questions on this topic, please
reply to this posting.

Regards, Frank Miller
Microsoft Support

This posting is provided AS IS with no warranties, and confers no rights.

Peer-to-peer newsgroups are available to help you interact with other users
of our products including Microsoft " Most Valuable Professionals" - MVP's.
For more information please see
http://communities.microsoft.com/newsgroups/default.asp?icp=GSS&slcid=us



Mon, 29 Nov 2004 23:49:20 GMT  
 Possible answer to Err 49: Bad DLL calling convention

Quote:
>From the description of the issue, I would suspect that the VBA Project may
>have become damaged and the recompile recreated the project. Access 2000
>and 2002 have a significantly different storage mechanism for compiled code
>than we used in Access 97 and before. In essence, what was saved in
>individual locations is now all lumped together in the VBA Project,
>affectionately referred to as the "blob," and can be quite large in size.

Unaffectionaly known to cause a decrease in performance especially
when working over a network.  <sigh>

Thanks for the clarifications.

Tony
--
Tony Toews, Microsoft Access MVP
   Please respond only in the newsgroups so that others can
read the entire thread of messages.
   Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm



Thu, 02 Dec 2004 04:01:55 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Possible answer to Err 49: Bad DLL calling convention

2. Run-time error '49': Bad DLL calling convention

3. Bad DLL calling convention (error 49)

4. Error 49: Bad Dll Calling convention

5. Help Re: error 49 Bad DLL calling convention

6. Error 49 -- Bad DLL Calling Convention

7. RunTime 49: Bad DLL Calling Convention

8. error 49 - bad dll calling convention

9. Bad Calling Convention error 49 - due to calling a Sub in a .bas module

10. Help! Bad DLL Convention(49)

11. error 49 - Bad DLL callling convention

12. Access200 - Error 49: "Bad DLL calling..."

 

 
Powered by phpBB® Forum Software