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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Explicit error 1

Status
Not open for further replies.

dawnd3

Instructor
Jul 1, 2001
1,153
US
Hi there, I was real quickly throwing together a database through the wizard. I went through the entire wizard and just before it was done it opened the VBA screen and highlighted the "option explicit" statement with an error message that said "duplicate error explicit statment." (something like that) First time I clicked ok and deleted the duplicate statement, reset the code and saved the form. It then froze up. I tried it a few more times, and sometimes it didn't freeze up but the option explicit statment that I deleted would return. I clicked on the help button for the error message and it basically just said that I needed to delete the duplicate, which is what I had done. I have tried the wizard several times and it keeps happening. Any ideas or suggestions? Thanks y'all!!

Dawn
 
It seems as if your VB project is corrupted. The easiest way to repair:
- create a new MDB
- import all database objects from the original one

Good luck!

F.
 
You have to remember that VBA and Access are seperate programs, make sure you are compiling your modules and saving your changes manually, ohh and try not to make any changes in debug mode, it's always best to open up whatever in design view then edit the code.

Shoot me down in flames if you want, but I'm a really fast worker (I have to be), and find that 'Option Explicit' just slows me down. I know 'Option Explicit' speeds up your code and all that, but would anyone actually notice the speed difference?, given that Access is actually quite fast anyway.

Andrew.
 
I appreciate both of your responses, however, this is happening ONLY when I create a db through the wizard and EVERY time I create through the wizard. If I create a new DB and that works, is there a way to permanently fix the corruption in the wizard databases?
 
Two remarks:
1. I am developing databases since 15 years and I have about 8 years experience with ACCESS. I never used a wizard to create databases and apparently this protected me from a relevant amount of grief.
2. The proposal to develop applications without "OPTION EXPLICIT" can only be a joke, I can not believe that this tip is serious!
 
Francescina,

You seem to have misunderstood my last post, at no point did I suggest anyone disables option explicit. I was simply stressing that you can often work faster if you disable it while developing a new piece of code. Tidying up code and adding error control and has always been something I've done afterwards. But Francescina why not tell us 3 benefits of using Option Explicit, except speed, I've already mentioned that.

Andrew.
 
Hi, Andrew,

Sorry that I misunderstood your message. I think it is not necessary to look for 3 reasons that speak for "option explicit". One is sufficient:

It makes certain that all your variables/function calls are correctly spelled.
Without it you will get into a nightmarish situation, especially at 3:00 a.m. when your eyes are turning red and your stomach is slowly dissolving due to an overdose of coffee.

How do you want to distinguish on the screen the vars

WhatTheHell (UCASE: WHATTHEHE LL) and
WhatTheHe11 (UCASE: WHATTHEHE 11)

Without Option Explicit you can never be certain that your app will behave properly in "extreme situations" (where error trapping has to do the job).

As for the speed, I never ever tried if there is a difference or not.

Happy programming!
 
Dawn,

Why not re-install the wizards?, I don't know if this will work but remembering that the wizards are actually databases themselves, it's possible they could be corrupted.

However, as Francescina pointed out - database wizards are next to useless, they have very little useful content and are only really useful for complete beginners. If you need an example to give you ideas or just somewhere to start from - why not look for example databases on the internet. I don't know any site off-hand but there must be some on the Microsoft website, and the chances are they will be a lot more helpfull than the wizards.

Andrew.
 
You are right Andrew, and Francescina, I don't want to sound like a COMPLETE beginner LOL. I just often have clients that are completely clueless to what a database looks like, so I try to show them something they can understand, a basic address/contact database. It was something that I could throw together in 30 seconds (as long as I didn't get the stupid error) :) Anyway, thanks for all your input. Please tell me good places to find samples on the internet if you have some. And, thanks for the insight on Option Explicit, I really had no clue why it was there and why there was an option to remove it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top