G
Guest
Hello,
I'm trying to build a query using strsql. The problem is in the where
clause. I have a field called identifiedstype and what I want is to add into
the where clause where identifiedstype = 'Person at scene' and [last name] =
somevalue. I'm prompted for an identifiedstype as if it's a parameter. My
code is below. Any assistance is greatly appreciated.
If Me.txtCrit1 > "" Then
If Me.txtOper1 = "like" Then
strSQL = "[" & Me.txtCrit1 & "]" & " " & (Me.txtOper1) & " '*" &
Trim(Me.txtVal1) & "*'" '
ElseIf Me.txtCrit1 = "Person At Scene Last Name" Then
strSQL = "[IdentifiedsType] = 'Person At Scene' And [last name] = " & "
'" & Trim(Me.txtVal1) & "'" '
ElseIf Me.txtCrit1 = "eventid" Or Me.txtCrit1 = "booknumber" Or
Me.txtCrit1 = "pagenumber" Or Me.txtCrit1 = "EVENTDATE" Or Me.txtCrit1 =
"ENTRYDATE" Then
strSQL = "[" & Me.txtCrit1 & "]" & " " & (Me.txtOper1) & "" &
(Me.txtVal1) & "" '
ElseIf Me.txtCrit1 > "" And Me.txtCrit1 <> "eventid" Or Me.txtCrit1 <>
"booknumber" Or Me.txtCrit1 <> "pagenumber" Or Me.txtCrit1 = "EVENTDATE" Or
Me.txtCrit1 = "ENTRYDATE" Then
strSQL = "[" & Me.txtCrit1 & "]" & " " & (Me.txtOper1) & "'" &
(Me.txtVal1) & "'" '
End If
End If
I'm trying to build a query using strsql. The problem is in the where
clause. I have a field called identifiedstype and what I want is to add into
the where clause where identifiedstype = 'Person at scene' and [last name] =
somevalue. I'm prompted for an identifiedstype as if it's a parameter. My
code is below. Any assistance is greatly appreciated.
If Me.txtCrit1 > "" Then
If Me.txtOper1 = "like" Then
strSQL = "[" & Me.txtCrit1 & "]" & " " & (Me.txtOper1) & " '*" &
Trim(Me.txtVal1) & "*'" '
ElseIf Me.txtCrit1 = "Person At Scene Last Name" Then
strSQL = "[IdentifiedsType] = 'Person At Scene' And [last name] = " & "
'" & Trim(Me.txtVal1) & "'" '
ElseIf Me.txtCrit1 = "eventid" Or Me.txtCrit1 = "booknumber" Or
Me.txtCrit1 = "pagenumber" Or Me.txtCrit1 = "EVENTDATE" Or Me.txtCrit1 =
"ENTRYDATE" Then
strSQL = "[" & Me.txtCrit1 & "]" & " " & (Me.txtOper1) & "" &
(Me.txtVal1) & "" '
ElseIf Me.txtCrit1 > "" And Me.txtCrit1 <> "eventid" Or Me.txtCrit1 <>
"booknumber" Or Me.txtCrit1 <> "pagenumber" Or Me.txtCrit1 = "EVENTDATE" Or
Me.txtCrit1 = "ENTRYDATE" Then
strSQL = "[" & Me.txtCrit1 & "]" & " " & (Me.txtOper1) & "'" &
(Me.txtVal1) & "'" '
End If
End If