Error: User-Defined type not defined

!Blue

Registered User.
Local time
Today, 22:33
Joined
Jul 4, 2008
Messages
28
There is a definite Access bug here - although this message may appear legitimatly there are times when the compiler looses it totally and get it's knickers in a twist...

A usual symptom of this happening is the message appearing and no code being highlighted to indicate where the error is....

I've noticed this appears to happen most oft when peforming class module name changes...

The only way I've found to solve the problem is to create a new (blank) database and import all the objects from the offending database and reset all startup options and references accordingly...

And hey presto! - no compile errors...

Of course this is a real pain in the butt to do this as frequently as I have to...

There is also another related problem pertaining to code intensive projects and the compiler - you may notice that the .mdb file grows in size much more (by megabytes at a time) than you might expect irrespective of
using the compact & repair function

Again I suspect this is due to the compiler loosing it and dumping old compiled chunks of code in the .mdb file without cleaning them out...

These are probably artifacts of the compiler attempting to peform partial compilation during development - probably something Microsoft thinks is pretty clever - and maybe it would be if there were no bugs in it - but
what would be cleverer would be to have a 'compile from scratch' menu option. Would save a lot of time & headaches...

Again the only solution I have found to this is create a new database and import all objects from the offending one.

I would be interested to hear from anyone who knows of a more expedient solution.

Access Version: 2003
 
I think your statement may be a little strong and all. Every error of this type, I've managed to track down to either a reference error or a failure to declare something. If you have a problem with something doing that, I think it would be good for you to post the db here so others may take a look and see what they see.

Calling something a bug may be fine, but a lot of times it isn't when someone may not have thought of a few more places to look.
 
It doesn't sound to me like you've made friends with the decompile shortcut switch?
http://www.mvps.org/access/bugs/bugs0008.htm

While I agree with you - chunks of compiled code can become out of sync with your VBA (see Michael Kaplan's totally definitive description of the topic http://www.trigeminal.com/usenet/usenet004.asp?1033) using the decompile switch can be much quicker than re-importing into a new MDB.

Whenever I have an application I'm spending a lot of time on - I create a shortcut in the same folder structure as that application for convenient decompiling whenever required. For less often occasions I have an MDB which I use to select (and store) another MDB's path and to decompile it - rather than mess on with writing command lines each time.

It's not a bad idea to re-import every once in a while anyway (there is also the undocumented SaveAsText and LoadFromText methods of the application object for UI objects as well as code which allow you to dump alot of binary baggage).
But doing it often would be a pain.
 
Hi Bob,

I did go to lengths to explain that if I import the code into a blank database with no code changes - it compiles ok... this is enough to prove that it is an Access bug.

Post the code..? tricky - there are 200+ code modules - @14,000 lines of code. Also I don't think the client would appreciate it...

Strong..? They are just the facts... Do you work for Microsoft..?

LPurvis: Decompile switch!!! I like the sound of that. I will check out the info you've supplied and let you know how I get on... Many thanks in advance....
 
Oh Joy..!!!

This is indeed a more expedient solution...

This works & solves my bloated mdb file problem in one fell stroke - can't thank you enough Leigh - if you're ever passing through Wiltshire I'll buy you drinks all night - cheap at twice the price... this problem has been bugging me for toooo long.

I still think it wouldn't have hurt MS to have put a 'Recompile All' option in the VBA Dev menu - wouldn't have to close & re-open...

Again - Many Thanks...
 
No worries - glad you're sorted.
I'll see if I can find any Yorkshire fall down juice for now though. ;-)
 

Users who are viewing this thread

Back
Top Bottom