Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Illogical "Query too complex" & "Bad DLL calling convention" errors

Error Resolution

Illogical "Query too complex" & "Bad DLL calling convention" errors

by  BoulderRidge  Posted    (Edited  )
Query too complex
Bad DLL calling convention - error 49

If you receive either or both of these errors while running VBA code and the error message does not seem to apply to your situation, here's another possible resolution.

Both of the above errors can legitimately be caused by the error description but I had a custom VBA function which was working for weeks and then after some edits started crashing with the above two errors. The first error showed up in my error handler message box but if I ran the offending function call manually I received the second error instead. Neither message seemed relevant to my code. After several attempts to resolve it by replacing the queries used in the function and doing the repair/compact routine, I was stuck. The function itself would complete correctly without going into its error handling routine but when control returned to the calling procedure it immediately errored.

What worked was that I exported a copy of the module as a backup and then copied and pasted the offending function into Word. Then I created a new module in the database and pasted lines of code from Word back into the new module, skipping blank lines and extra comments (ie. not a wholesale copy and paste, but several 1-3 line copies and pastes.) I saved the new module with the "new" function and then deleted just that function from the original module. Saved everything and magically now it works!

Wouldn't be too big a stretch to imagine this could work with other illogical error messages too...B-) Anyone know what could get into a piece of code that would make it go wacky like that?
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top