I think MS truly believes they are doing you a favor and making life easy. Goes along with allowing you to put spaces and characters in field names, every template using macros instead of vba, default properties and methods, and things like MVF. All things to make your life simpler in the short run. Who wants to waste time declaring variables now when you can simply spend hours debugging later.So that got me to thinking, perhaps there is a valid reason, which escapes me completely.
That might be, but why not by default?You can set it as a default in File >> Options >> Current Database, I believe.
That might be, but why not by default?
That argument seems to be the opposite of using the statement?
My theory is that they know why it's a bad strategy but they have chosen not to implement the more appropriate Option Explicit because it would break thousands of apps and confuse people.I think MS truly believes they are doing you a favor and making life easy. Goes along with allowing you to put spaces and characters in field names, every template using macros instead of vba, default properties and methods, and things like MVF. All things to make your life simpler in the short run. Who wants to waste time declaring variables now when you can simply spend hours debugging later.
VBA is weak typed because it allows implicit type conversions. It can automatically convert data types. e.g. a string can be multiplied by a number, and VBA will convert the string to a numeric type as needed. VBA's default type is a Variant, which can hold any type of data. That flexibility makes it a weak typed language. However, using Option Explicit enforces strong typing. Even if MS were to make Option Explicit the default, any existing code without it would still work.
I have downloaded members dbs from here and other sites.That's what I thought too but I'm not sure how changing the default to be Option Explicit would change existing applications since it only comes into play when you create a new module. If you take an old db and change the default to Option Explicit, no existing modules are affected. The app still works or it doesn't.
"Don't make me (the user) think!"Why MS, do not have it set as default, I have no idea.![]()
Loose the "Pre".It's a Pre Compile Directive
Just as an aside, I have a db where I experiment with code, forms, sql etc. must be over 20 years old (or at least old code etc) as it was upgraded from 2003 to 2010 15 years ago.However, VBA in Access is compile-on-need, not necessarily every time you launch a form or report
If the database application was created in 32bit and you open it in 64bit Access the first time, the whole project needs to be recompiled for 64bit. - Believe it or not.Now I have moved to 64bit access,
I'm not entirely sure about VB6, but I think it does.IIRC, by default, the vb.net and vb6 compilers enforce explicit variable declaration?