Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Mar 2003
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Arrow query database by phone number

    connection to a sql db, my select statement is not working for Telephone and fax numbers otherwise it does work, any suggestions?

    //garrItem is from a text field in a form on the same page

    If Trim(garrItem) <> "" Then

    If gstrSql = "" Then
    gstrSql = "SELECT TOP 50 MemberID, FirstName, LastName, EmailAddress, GradYear, ProvinceName, OptJoinProgram, Unsubscribe, LaOn, LoyaltyPoint, MDelect, Phar_Select, Fax, Tel" _

    & " FROM Member LEFT JOIN Province ON Member.ProvinceID = Province.ProvinceID" _

    & " WHERE"

    If gstrFilter = "membersonly" Then
    gstrSql = gstrSql & " MD_Select = 0 AND Pharmacists_Select = 0 AND"
    End If

    Else
    gstrSql = gstrSql & " AND "
    End If

    gstrSql = gstrSql & " (FirstName LIKE '" & Replace(Trim(garrItem), "'", "''") & "%'"
    gstrSql = gstrSql & " OR LastName LIKE '" & Replace(Trim(garrItem), "'", "''") & "%'"
    gstrSql = gstrSql & " OR EmailAddress LIKE '" & Replace(Trim(garrItem), "'", "''") & "%'"
    gstrSql = gstrSql & " OR Tel LIKE '" & garrItem & "%'"
    gstrSql = gstrSql & " OR Fax LIKE '" & garrItem & "%'"

    If IsNumeric(garrItem) Then
    gstrSql = gstrSql & " OR GradYear = " & garrItem & " OR MemberID = " & garrItem & ")"
    Else
    gstrSql = gstrSql & ")"
    End If

    End If

  • #2
    Regular Coder
    Join Date
    Mar 2003
    Posts
    165
    Thanks
    0
    Thanked 0 Times in 0 Posts
    forgot to mention that the ph#s & fax# are in this format: xxx-xxx-xxxx

  • #3
    Senior Coder
    Join Date
    Nov 2002
    Location
    North-East, UK
    Posts
    1,265
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Response.Write gstrSql to see what is being sent


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •