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?
Quick Prototyping: If you are rapidly testing ideas or creating small scripts, not using Option Explicit can speed up the process. You can write code without worrying about variable declarations.
However, I disagree with both of those reasons because prototypes usually evolve into working applications, and it's a bad habit for beginners to not declare variables. I was taught to always declare variables ever since I wrote my first BASIC program for finding perfect numbers on a Honeywell GE 635 Mark II Timesharing System at Dartmouth. I still have the punched paper tape of the code that was read by the Teletype Model 33 ASR terminal.Learning Environment: Beginners may find it easier to start coding without the requirement to declare variables. This can help them focus on learning basic syntax and logic without additional complexity.
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.
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.Me too. Unfortunately backwards compatibility means it won’t ever be changed
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.