melissagreen
New member
- Local time
- Yesterday, 20:48
- Joined
- Jul 24, 2015
- Messages
- 7
Hi all. I have created a multi field search form that have 2 textbox and 2 multiselect listbox(extended). How to make the search form query correctly? Below are the details. Thanks
Form
frmSearchForm
2 textbox and 2 multiselect listbox
Textbox 1 > txtFirstName
Textbox 2 > txtLastName
Listbox 1 > lboSports
Listbox 2 > lboSchool
Query
Query > qrySearchForm
Table
tblStudent with field FirstName, LastName, Sports, School
Inside my qrySearchForm, in the field FirstName and LastName criteria.
I've input this code
same goes for LastName
I also have a button that run the query qrySearchForm
With this.. how am I going to make the query run successfully with multiselect listbox ? I understand that there are a lot of examples of the vba code for multiselect but that is only for multiselect alone and not like my search form that combine textbox and multiselect listbox
I would appreciate if you can guide me on how to achieve this result correctly. I'm a totally beginner. e.g What is the code..where to put the code. Thanks a million guys
Form
frmSearchForm
2 textbox and 2 multiselect listbox
Textbox 1 > txtFirstName
Textbox 2 > txtLastName
Listbox 1 > lboSports
Listbox 2 > lboSchool
Query
Query > qrySearchForm
Table
tblStudent with field FirstName, LastName, Sports, School
Inside my qrySearchForm, in the field FirstName and LastName criteria.
I've input this code
Code:
LIKE "*" & [Forms]![frmSearchForm]![txtFirstName] & "*"
Code:
LIKE "*" & [Forms]![frmSearchForm]![txtLastName] & "*"
With this.. how am I going to make the query run successfully with multiselect listbox ? I understand that there are a lot of examples of the vba code for multiselect but that is only for multiselect alone and not like my search form that combine textbox and multiselect listbox
I would appreciate if you can guide me on how to achieve this result correctly. I'm a totally beginner. e.g What is the code..where to put the code. Thanks a million guys