1
按名稱搜索工作,但是當我試圖還日期進行過濾和它出現這個錯誤:搜索從/名稱,運輸日期
運行時錯誤「3075」:
Syntax error(missing operator) in query expression 'DriverFirst Like'*paul*'TransportDate Like '*4/5/2015*".
下面你的代碼:
Private Sub Command33_Click()
Dim strSQL As String
Dim boolBefore As Boolean
strSQL = ""
boolBefore = False
If Len(Me.txtSrch) > 1 Then
If (boolBefore) Then
strSQL = strSQL & " AND "
End If
strSQL = strSQL & "DriverFirst Like '*" & Me.txtSrch & "*'"
End If
If Len(Me.fromDate) > 1 Then
If (boolBefore) Then
strSQL = strSQL & " AND "
End If
strSQL = strSQL & "TransportDate Like '*" & Me.fromDate & "*'"
boolBefore = True
End If
Me.Form.Filter = strSQL
Me.Form.FilterOn = True
End Sub
再次用黃色標記這個Me.Form.Filter = strSQL –