Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I am working on code to filter reco

Status
Not open for further replies.

weightinwildcat

Programmer
May 11, 2010
84
US
I am working on code to filter records for display on a list box. In a few cases, the text field for product codes has the symbol'#' as the first character. Any thoughts on how to filter for this, since this is a special character?
 
You should be able to replace the # with [#] like:

Code:
Private Sub txtFind_AfterUpdate()
    Dim strValue As String
    strValue = Replace(Me.txtFind, "#", "[#]")
    Me.lboName.RowSource = "SELECT tblTest.ID, tblTest.ShortText FROM tblTest WHERE ShortText Like """ & _
        strValue & "*"" ORDER BY tblTest.[ShortText];"
End Sub

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top