Hi, any help is greatly appreciated..... I have a dropdown field in a form and a search command button to search within a form. See code below
Private Sub CmdLetterSearch_Click()
Dim LSQLs As String
Dim LSearchStrings As String
Dim RecordCounts As String
Dim lRecCounts As Integer
If Len(cboLetter) = 0 Or IsNull(cboLetter) = True Then
MsgBox "You must enter a search string."
Else
LSearchStrings = cboLetter
'Filter results based on search string
LSQLs = "select * from qRECS"
LSQLs = LSQLs & " where strLetterIndentification = '*" & LSearchStrings & "*'"
Form_frmRECS.RecordSource = LSQLs
lblLetter.Caption = "Letter Identification Details: Filtered by: '" & LSearchStrings & "."
'Clear search string
cboLetter = ""
MsgBox "Results have been filtered. For Letter Identfication Number: " & LSearchStrings & " "
The issue is that the records that can be chosen from the dropdown field may contain symbols ( &, !, *) alonf with text and numbers. The code I have does not filter those out.
Thanks in advance for your help.
Private Sub CmdLetterSearch_Click()
Dim LSQLs As String
Dim LSearchStrings As String
Dim RecordCounts As String
Dim lRecCounts As Integer
If Len(cboLetter) = 0 Or IsNull(cboLetter) = True Then
MsgBox "You must enter a search string."
Else
LSearchStrings = cboLetter
'Filter results based on search string
LSQLs = "select * from qRECS"
LSQLs = LSQLs & " where strLetterIndentification = '*" & LSearchStrings & "*'"
Form_frmRECS.RecordSource = LSQLs
lblLetter.Caption = "Letter Identification Details: Filtered by: '" & LSearchStrings & "."
'Clear search string
cboLetter = ""
MsgBox "Results have been filtered. For Letter Identfication Number: " & LSearchStrings & " "
The issue is that the records that can be chosen from the dropdown field may contain symbols ( &, !, *) alonf with text and numbers. The code I have does not filter those out.
Thanks in advance for your help.