rubberduck-vba / Rubberduck

Every programmer needs a rubberduck. COM add-in for the VBA & VB6 IDE (VBE).
https://rubberduckvba.com
GNU General Public License v3.0
1.93k stars 301 forks source link

Inspection for inconsistent use of `Option Compare` across Access VBA modules #2659

Open ThunderFrame opened 7 years ago

ThunderFrame commented 7 years ago

When executing the following procedure, in modules declared with different Option Compare statements, the user will get different results:

Sub test()
  Debug.Print InStr(1, "abc", "ABC")
End Sub

There are genuine reasons for this to be deliberate, but it could also result in unpredictable results.

Sub foo()
  ModuleCompareNotSet.test   'Prints 0
  ModuleCompareBinary.test   'Prints 0
  ModuleCompareDatabase.test 'Prints 1
  ModuleCompareText.test     'Prints 1
End Sub

as-seen-on-SO http://stackoverflow.com/questions/42097858/vba-instr-excel-vs-access/42102568#42102568

PeterMTaylor commented 7 years ago

Just thinking here, would this inspection affect the source control section when importing different classes/modules/projects? How can RD know which ones it belongs to?