Hi,
I have a combobox (CboFilterFinancialPeriod) containing a selection of dates in format dd-mm-yyyy. I have a listbox (lstsearch) on the same form (frmTenderEnquiryIndexFind) as the combobox that is based on a query (qrytenderenquiryindexfind). The idea is that when a user selects a date from the combobox and clicks a button the listbox filters to display all records containing that date.
I know there are similar threads dealing with filtering a listbox from a combobox but they all seem to deal with a wildcard Like operator (is that the right term?) If I implement this solution then I get multiple months being returned if I filter for January or February.
Is there a way of redoing the code below to return an EXACT match only on the data ...not a wildcard search?
As always any help is appreciated. I realise this is most likely simple and fail to understand why I havent figured it out yet!
Thanks all
Dave
I have a combobox (CboFilterFinancialPeriod) containing a selection of dates in format dd-mm-yyyy. I have a listbox (lstsearch) on the same form (frmTenderEnquiryIndexFind) as the combobox that is based on a query (qrytenderenquiryindexfind). The idea is that when a user selects a date from the combobox and clicks a button the listbox filters to display all records containing that date.
I know there are similar threads dealing with filtering a listbox from a combobox but they all seem to deal with a wildcard Like operator (is that the right term?) If I implement this solution then I get multiple months being returned if I filter for January or February.
Is there a way of redoing the code below to return an EXACT match only on the data ...not a wildcard search?
Code:
Private Sub Search4_Click()
On Error GoTo Error_Search4_Click:
If IsNull(Me!CboFilterFinancialPeriod) Then
GoTo Finish:
Else
Me!LstSearch.RowSource = "SELECT * FROM QryTenderEnquiryIndexFind Where [PeriodStartDate] Like '*" & Me!CboFilterFinancialPeriod & "*';"
End If
Finish:
Exit Sub
Exit_Search4_Click:
Exit Sub
Error_Search4_Click:
MsgBox Err.Number & Err.Description
Resume Exit_Search4_Click
End Sub
As always any help is appreciated. I realise this is most likely simple and fail to understand why I havent figured it out yet!
Thanks all
Dave