步驟以下:字符串
一、打開VBA(ALT+F11)
二、右鍵模塊=》插入=》模塊
三、粘貼如下代碼:it
Public Function CutStr(chkStr As String) As String
'截取字符串中第一個數字符
Dim i As Long
For i = 1 To Len(chkStr)
If Mid(chkStr, i, 1) Like "[0-9]" Then
CutStr = Mid(chkStr, i, 1)
Exit Function
End If
Next i
CutStr = chkStr
End Functionio
四、保存,關閉VBAim
五、在access中新建查詢,在默認的語句後面增長where條件
SELECT ......FROM 表 where CutStr(字段)== 5查詢