The following search code works great in an Access 2000 database, but now that I've convered to an Access 2003 ADP, it doesn't return any results:
-----------------------------------------------------
Private Sub btn_OK_Click()
On Error GoTo btn_OK_Err
Dim strWhere As String
Dim strAnd As String
Dim strSelect As String
strSelect = "Select [DebtorID],[AccountName],[DebtorFirstName], [DebtorLastName], [SpouseName], [ClientID], [HomePhone], [OtherPhone], [Address1], [City], [State], [POE], [DebtorID], [DL_number] from [tblDebtors]"
strAnd = ""
strWhere = ""
If Not IsNull(Me!TxtAcctName) And Me!TxtAcctName <> "" Then
strWhere = strWhere & strAnd & " AccountName like '" & Me!TxtAcctName & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtLast) And Me!TxtLast <> "" Then
strWhere = strWhere & strAnd & " DebtorLastName like '" & Me!TxtLast & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtSpouse) And Me!TxtSpouse <> "" Then
strWhere = strWhere & strAnd & " SpouseName like '" & Me!TxtSpouse & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtClientID) And Me!TxtClientID <> "" Then
strWhere = strWhere & strAnd & " ClientID like '" & Me!TxtClientID & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtPhone) And Me!TxtPhone <> "" Then
strWhere = strWhere & strAnd & " HomePhone like '" & Me!TxtPhone & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtOtherPhone) And Me!TxtOtherPhone <> "" Then
strWhere = strWhere & strAnd & " OtherPhone like '" & Me!TxtOtherPhone & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtAddress1) And Me!TxtAddress1 <> "" Then
strWhere = strWhere & strAnd & " Address1 like '" & Me!TxtAddress1 & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtCity) And Me!TxtCity <> "" Then
strWhere = strWhere & strAnd & " City like '" & Me!TxtCity & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtState) And Me!TxtState <> "" Then
strWhere = strWhere & strAnd & " State like '" & Me!TxtState & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtPOE) And Me!TxtPOE <> "" Then
strWhere = strWhere & strAnd & " POE like '" & Me!TxtPOE & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtDebtorID) And Me!TxtDebtorID <> "" Then
strWhere = strWhere & strAnd & " DebtorID like '" & Me!TxtDebtorID & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtDLNumber) And Me!TxtDLNumber <> "" Then
strWhere = strWhere & strAnd & " DL_NUmber like '" & Me!TxtDLNumber & "*'"
strAnd = " And"
End If
If Not IsNull(strWhere) And strWhere <> "" Then
Forms!FrmDebtorList!Combo0.RowSource = strSelect & "Where" & strWhere
Else
Forms!FrmDebtorList!Combo0.RowSource strSelect
End If
btn_Ok_Done:
DoCmd.Close
Exit Sub
Forms!FrmDebtorList!Combo0.Requery
btn_OK_Err:
MsgBox Error$
GoTo btn_Ok_Done
End Sub
-----------------------------------------------------
Any ideas why?
Thanks,
Steve
Steve
---------------------------------------
IF WebApplicationProgrammer = True Then
ElectronicSheepHerder = True
End If
-----------------------------------------------------
Private Sub btn_OK_Click()
On Error GoTo btn_OK_Err
Dim strWhere As String
Dim strAnd As String
Dim strSelect As String
strSelect = "Select [DebtorID],[AccountName],[DebtorFirstName], [DebtorLastName], [SpouseName], [ClientID], [HomePhone], [OtherPhone], [Address1], [City], [State], [POE], [DebtorID], [DL_number] from [tblDebtors]"
strAnd = ""
strWhere = ""
If Not IsNull(Me!TxtAcctName) And Me!TxtAcctName <> "" Then
strWhere = strWhere & strAnd & " AccountName like '" & Me!TxtAcctName & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtLast) And Me!TxtLast <> "" Then
strWhere = strWhere & strAnd & " DebtorLastName like '" & Me!TxtLast & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtSpouse) And Me!TxtSpouse <> "" Then
strWhere = strWhere & strAnd & " SpouseName like '" & Me!TxtSpouse & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtClientID) And Me!TxtClientID <> "" Then
strWhere = strWhere & strAnd & " ClientID like '" & Me!TxtClientID & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtPhone) And Me!TxtPhone <> "" Then
strWhere = strWhere & strAnd & " HomePhone like '" & Me!TxtPhone & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtOtherPhone) And Me!TxtOtherPhone <> "" Then
strWhere = strWhere & strAnd & " OtherPhone like '" & Me!TxtOtherPhone & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtAddress1) And Me!TxtAddress1 <> "" Then
strWhere = strWhere & strAnd & " Address1 like '" & Me!TxtAddress1 & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtCity) And Me!TxtCity <> "" Then
strWhere = strWhere & strAnd & " City like '" & Me!TxtCity & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtState) And Me!TxtState <> "" Then
strWhere = strWhere & strAnd & " State like '" & Me!TxtState & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtPOE) And Me!TxtPOE <> "" Then
strWhere = strWhere & strAnd & " POE like '" & Me!TxtPOE & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtDebtorID) And Me!TxtDebtorID <> "" Then
strWhere = strWhere & strAnd & " DebtorID like '" & Me!TxtDebtorID & "*'"
strAnd = " And"
End If
If Not IsNull(Me!TxtDLNumber) And Me!TxtDLNumber <> "" Then
strWhere = strWhere & strAnd & " DL_NUmber like '" & Me!TxtDLNumber & "*'"
strAnd = " And"
End If
If Not IsNull(strWhere) And strWhere <> "" Then
Forms!FrmDebtorList!Combo0.RowSource = strSelect & "Where" & strWhere
Else
Forms!FrmDebtorList!Combo0.RowSource strSelect
End If
btn_Ok_Done:
DoCmd.Close
Exit Sub
Forms!FrmDebtorList!Combo0.Requery
btn_OK_Err:
MsgBox Error$
GoTo btn_Ok_Done
End Sub
-----------------------------------------------------
Any ideas why?
Thanks,
Steve
Steve
---------------------------------------
IF WebApplicationProgrammer = True Then
ElectronicSheepHerder = True
End If