"Option Explicit" not working? (1 Viewer)

I know it's been awhile since DataMiner posted his problem but I had the same thing happen to me yesterday.

I always have option explicit on as it's such a useful tool but having Rem'd out some code, including some variable declarations I was very surprised when I used Debug/Compile TemplateProject and found that it reported no errors. I tried to do the same in a number of forms, all with the same result.

Following a Google search I came across this link in your forum and eventually came to joelanthony333's solution, which at first sight I was a little sceptical of, but to my amazement it worked perfectly. Thank you!

My problem was with Word VBA, I don't use Access but I'll be back as many VBA problems/solutions occur in the various Office programs.
 
at the risk of bumping an old thread - it's a perennial problem with non printing characters

presumably the option was not "option explicit" but "option explicit .... plus some added junk"
 
The solution, as it has been many times in the past for me, is to decompile. It slipped my mind to do this when the compile function wasn't finding missing variables in one of my modules, so I ended up here.

Run from command prompt >> msaccess.exe /decompile "C:\Your Path To\YourDBName.mdb" (from a source that I am not allowed to cite).
 
Copy and paste the module that you're doing all this with.

Let us see what we're working with here.
 
It's not a problem with the user code. It is an internal problem of the MS Access compiler, probably because the code project is stored in a semi-compiled state. It caused me grief in Access 2000 and it is still a problem in 2010 (I can't recall an event with 2013 but I've only been using it for personal use). I've tried to replicate the issue but it only ever finds its way into my life by chance.
I used to rebuild the entire project by creating a new project and importing all of the elements from the corrupted file. Then it happened after a full day of work that I never backed up and the module with the twelve hours of work was corrupted and unloadable. Thanks to a bit of digging 'decompile' saved the day and I was back up and running. A similar problem creeps into my projects once or twice a year so it is not really a huge deal but without knowing about the decompile command line switch it can be a major frustration.
 
Run from command prompt >> msaccess.exe /decompile "C:\Your Path To\YourDBName.mdb" (from a source that I am not allowed to cite).
As someone who regularly decompiles to keep the beast healthy, create a shortcut to ms access in the program folder then edit the properties target string by adding /decompile - don't forget the space before the /

.....\Office14\MSACCESS.EXE" /decompile

Then save the shortcut to your desktop or taskbar.

To decompile an accdb, simply click on the shortcut - the access window opens and you can select the file you want to decompile. Once the file is open, compact it before closing.

It is best to either disable any auto run forms/macros or hold down the shift key before opening (assuming you haven't disabled this feature:)) but not essential
 
Bahahaha. Can always count on this forum to pick out fun stuff like that! :)

That's my most common typo. I'm cursed :P
 
Courtesy bump.

I found this awesome solution on an Excel forum:




Footnotes:
* An "If" was added to paragraph 3 by JoelAnthony333 for grammar purposes.

Edit:
P.S. I am hoping to win my 3rd NBA Championship with the Miami Heat in 2013-2014.
2024 and just found this answer - worked for me - working with Access since version 2! - big thank you
 

Users who are viewing this thread

Back
Top Bottom