Dropdown box on form created from Query

Vergy39

Registered User.
Local time
Today, 01:26
Joined
Nov 6, 2009
Messages
109
OK, I have a form that is created form a query to pull data on an associate. Currently, when you click on the form, you have to enter the associates last name to pull the data. Instead of typing in the last name, I want a dropdown box so all the auditor has to do is click on the name of the writer. Any suggestions. Currently on the Query, I have [Enter Associate Last Name] in the criteria field for Last Name.

Thanks for your help in advance.
David V
 
The Combo Box Wizard allows the user to select "Find a record on my form based on the value I selected in my combo box".
 
Geezer's suggestion of using the Combobox Wizard with the third option is the standard way of doing this, but you have to make a calculated field to base it on, unless you're sure you'll never have two or more associates with the same last name.

The problem is that if the combobox is pulling a record based only on the last name, and you have, say

Allen James
Allen Kevin
Allen Leon

the record for Allen James will always be retrieved. The command the combobox wizard uses is

rs.FindFirst

which does just that; finds the FIRST record in the recordset with the last name of the selected row. The fix for this involves using a calculated field in a query. If the form is based directly on a table, you need to make a simple query including all the fields of the table, and then change the RecordSource for the form from the table to the query. If the form is already based on a query, more's the better. All form really should be based on queries, for situations just like this.

Now open the query in Design View, and in a blank "Field" box enter this code:

CompleteName: [LastName] & " " & [FirstName]

Save and Exit Design View

Run you query now to make sure you have it right. You should now have a field named CompleteName, with the last name and first name in it, separated by a space.

Now, delete your current combobox, create another combobx based on your calculated CompleteName field that you just added to the query. Not only will Access take you to the correct Allen, if you keep entereing the name (typing Allen L for instance will take you to Allen Leon) when you click on Allen Leon it’ll take you to his record.
 
Good Afternoon MissingLinq, your suggestion is exactly what I am looking for, but after following your instructions, it did not work out. I still have to type the associates last name into the parimeter value to pull the form. To help you help me, I have attached a copy of the database. The query that the form is based on is called "tblIssues by Writer" and the form is called "tblIssues by Writer". You will see in the query, I have [Enter Associate Name] in the criteria that is labled "LastName". This brings up a parimeter box where you type in the last name. I would like this box to have a drop down box that is related to the Employees table or the Employee id feild on the tblIssues tble. Any assistance is greatly appreciated.

Thanks
David V
 

Attachments

Users who are viewing this thread

Back
Top Bottom