FancyPrairie
Programmer
Assume I have an employee table and one of the columns represents a Department ID. I trying to create a general purpose routine where the user can select the dept they want to search for or filter on.
Now the search can be done 2 ways. User selects the ID from a combobox or the user enters the department name with a wildcard.
Since the employee ID stores the dept id, I can search the employee table for a dept whose ID equals the one the user selected from the combobox.
But how do I search the employee table when the combobox contains a wildcard (i.e. dept*).
Note that I can't create a query to do the search, I need to do the search on the form's recordset (i.e. me.recordset.findfirst).
It's been awhile, but I thought there was a LookUp method to do this (i.e. LookUp.DeptComboBox Like "Hum*")
Example:
DeptComboBox on Employee form:
Control Source ... lngDeptID
RowSource ........ Select lngDeptID, strDeptName From...
Bound Column ..... 1
Column Count ..... 2
Width ............ 0";1"
SearchComboBox on Search form
RowSource ........ Select lngDeptID, strDeptName from...
Bound Column ..... 2 (so I can enter wildcards)
Column Count ..... 2
Width ............ 0";1"
me.recordset.findfirst "LookUp.lngDeptID" Like 'SearchCombobox.value'"
Now the search can be done 2 ways. User selects the ID from a combobox or the user enters the department name with a wildcard.
Since the employee ID stores the dept id, I can search the employee table for a dept whose ID equals the one the user selected from the combobox.
But how do I search the employee table when the combobox contains a wildcard (i.e. dept*).
Note that I can't create a query to do the search, I need to do the search on the form's recordset (i.e. me.recordset.findfirst).
It's been awhile, but I thought there was a LookUp method to do this (i.e. LookUp.DeptComboBox Like "Hum*")
Example:
DeptComboBox on Employee form:
Control Source ... lngDeptID
RowSource ........ Select lngDeptID, strDeptName From...
Bound Column ..... 1
Column Count ..... 2
Width ............ 0";1"
SearchComboBox on Search form
RowSource ........ Select lngDeptID, strDeptName from...
Bound Column ..... 2 (so I can enter wildcards)
Column Count ..... 2
Width ............ 0";1"
me.recordset.findfirst "LookUp.lngDeptID" Like 'SearchCombobox.value'"