我目前无法测试代码(没有笔记本电脑),但在If
语句中如下所示:
Dim StrA As String, StrB As String
IF StrA = StrB Then
'code for true result
Else
'code for false result
End If
If
语句是以二进制还是文本方式检查字符串?
答案 0 :(得分:4)
比较通常是文本的,stra = STRA,但你可以使用StrComp:
StrComp("stra","STRA",vbbinarycompare)
http://office.microsoft.com/en-ie/access-help/strcomp-function-HA001228914.aspx
Sub IsIt()
'Option Compare Database (default): True
'Option Compare Text : True
'Option Compare Binary : False
If "stra" = "STRA" Then
Debug.Print True
Else
Debug.Print False
End If
End Sub
答案 1 :(得分:2)
取决于settings option compare text
最常见,我认为