Search Function with Drop down Menu

Breanna

Registered User.
Local time
Today, 11:16
Joined
Dec 29, 2014
Messages
49
Here is what I need.
I have a form with First name, Last name, Employee number, Information. The information box is a drop down menu with four options (contact, emergency, company, personal) I would like to be able to enter in search criteria for an employee using one of last name first name or employee number then choose an option from drop down box click a button to search and have it pull up just the info I needed.

What I am thinking of doing:
I think I have two options but i am not sure which would be more efficient.

1. creating a query and using the criteria from design mode to have it filter the information. The only problem with this one is I do not know how to set it up with the drop down box from the form. Or would I need multiple querys for each option or just one with all of it?

2. writing code for the search button on the form that will bring up the appropriate query (I think I would then have to create a query for each drop down option)

Please let me know what you think would be more efficient and how I would get that started. I am very very new to access using 2013 version and hope what I am looking for makes sense.
 
I am not sure if this was the best way to go about this issue. Would still appreciate an opinion on if I made this more complicated than it needed.

So in order to solve my issue what I did was create a form like this

Employee Number: (text box to type in)
First name: (textbox to type in)
Last Name: (textbox to type in)
Information: Drop down with 4 different options
Search Button.

I created a query for each of the 4 options. In the query under criteria I used the build tool to set up parameters. (i.e Like "*" & [Forms]![Main Page]![NavigationSubForm].[Form]![EmployNum2] & "*" ) The only issue with this is that I had to do it for each section in each query (so 12 times total)

Then I created a button with VBA code to open a query based on what option was chosen from the information dropbox.

This is all functioning so far how I need it (I might have to change a few things once I use it more) But I am still wondering if there would have been an easier way to set this up? It was the only thing I could think of after doing more research.
 

Users who are viewing this thread

Back
Top Bottom