MS Access を使用してマルチフィールド検索フォームを作成するこのコードと、シンテックス エラーへの参照があります。
Private Sub cmdSearch_Click()
On Error GoTo errr
Me.infot_subform1.Form.RecordSource = " select * from infot " & BuildFilter
Me.infot_subform1.Requery
Exit Sub
errr:
MsgBox Err.Description
End Sub
Private Function BuildFilter() As Variant
Dim varWhere As Variant
Dim tmp As String
tmp = """"
Const conJetDate = "\#dd\/mm\/yyyy\#"
varWhere = Null
If Me.txtID > "" Then
varWhere = varWhere & "[ID] like" & Me.txtID & "AND"
End If
If Me.txtName > "" Then
varWhere = varWhere & "[Name] like" & tmp & Me.txtName & tmp & "AND"
End If
If IsNull(varWhere) Then
varWhere = ""
Else
varWhere = "Where" & varWhere
If Right(varWhere, 5) = "AND" Then
varWhere = Left(varWhere, Len(varWhere) - 5)
End If
End If
BuildFilter = varWhere
End Function