Concatenating strings in VBA

前端 未结 3 724
心在旅途
心在旅途 2021-01-17 18:29

I\'m maintaining an application written in Microsoft Access with VBA.

I\'m glancing over my code and have just noticed I have subconsciously been concatenating strin

3条回答
  •  轮回少年
    2021-01-17 19:01

    Some examples, from the VBA immediate window (the difference between the third and fourth is particularly vexing):

    Print "5" & 6
    56
    
    Print 5 & 6
    56
    
    Print "5" + 6
     11 
    
    Print "5" + "6"
    56 
    
    Print "Five" & 6
    Five6
    
    Print "Five" + 6 'Type mismatch
    
    Print "5" & Null
    5
    
    Print "5" + Null
    Null
    

提交回复
热议问题