A2007 VBA Intellisense getting confused of which class is which (1 Viewer)

mdlueck

Sr. Application Developer
Local time
Today, 15:53
Joined
Jun 23, 2011
Messages
2,631
I have bumped into VBA Intellisense seemingly getting confused as to which class is which.

1) For In-Memory collection classes, I CamelCase my attributes.
2) For DB table classes, however, I create alllowercase attributes to match up with the DB columns.

Somehow Intellisense realizes similarities between the DB class and the In-Memory Collection Class such that it insists to cross pollinate case sensitivity where attribute names happen to be the "same" in caseless terms.

"But the code is talking to separate classes, instances of objects of different classes!!!" :banghead:

Any idea why VBA Intellisense would insist on MatchingCase across different classes and the code which touches / interfaces said classes? It is leading to funky looking case in the code, examples:

Code:
    With newItem
      [B][COLOR=Blue].fasrule[/COLOR][/B] = strFASRule
      .FASMessageXSD = strXSD
      strKey = [B][COLOR=Blue].fasrule[/COLOR][/B]
    End With
Forced all lower case due to the DB table class... but this is in the In-Memory collection class area of the code. Which is defined here in another module:

Code:
'Attributes for fasmessages table
Public id As Variant
Public authid As Integer
Public authusername As String
Public logtimestamp As String
Public [B][COLOR=Blue]fasrule[/COLOR][/B] As String
Public fasstatus As String
Public fasmessage As String
So if I force the Collection attribute back to CamelCase... (fixed version of the Collection Class Item class)

Code:
'FASRule API's
Public Property Get [B][COLOR=Blue]FASRule[/COLOR][/B]() As String
On Error GoTo Err_FASRule

  [B][COLOR=Blue]FASRule [/COLOR][/B]= strFASRule

Exit_FASRule:
  Exit Property

Err_FASRule:
  Call errorhandler_MsgBox("Class: " & TypeName(Me) & ", Property: Get FASRule()")
  FASRule = vbNullString
  Resume Exit_FASRule

End Property

Public Property Let [B][COLOR=Blue]FASRule[/COLOR][/B](ByVal newFASRule As String)
On Error GoTo Err_FASRule

  strFASRule = newFASRule

Exit_FASRule:
  Exit Property

Err_FASRule:
  Call errorhandler_MsgBox("Class: " & TypeName(Me) & ", Property: Let FASRule()")
  Resume Exit_FASRule

End Property
This mysteriously changes the DB class to also be CamelCase!

Code:
'Attributes for fasmessages table
Public id As Variant
Public authid As Integer
Public authusername As String
Public logtimestamp As String
Public [B][COLOR=Blue]FASRule[/COLOR][/B] As String
Public fasstatus As String
Public fasmessage As String
rrrrrr????? What's going on? I have never seen VBA Intellisense cross pollinate between distinct classes before.
 
Last edited:

DJkarl

Registered User.
Local time
Today, 14:53
Joined
Mar 16, 2007
Messages
1,028
I've confirmed on my office 2003 machine this behavior exists as well. It seems odd but does not seem to actually impact the code running. I did notice that it only changes once you compile the project, otherwise it happily leaves them as you typed them.
 

mdlueck

Sr. Application Developer
Local time
Today, 15:53
Joined
Jun 23, 2011
Messages
2,631
Thank you for confirming the bug in VBA. I was concerned that I had place an unintended dependency between the distinct classes.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 15:53
Joined
Feb 19, 2002
Messages
43,231
I ran into a stranger one a few months ago. I ran a query and the query changed the case of the column names in the table. Now that's scarey.
 

Users who are viewing this thread

Top Bottom