Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
How do I create a Combo box that allow user to retrieve existing record from database and also adding new record to the table.

thanks in advance,

 
You need to have a form with an underlying table with a field that the selected results from the combobox will go (I assume you already do).

In order to retrieve the existing records for the combobox, I would suggest creating a query and basing the combobox on the query.

With the form in design mode, use the combobox wizard. It will ask you to chose the table or query where the existing records are coming from. Chose the query that you made. When it ask you which field you want to save the data in, pick the field in the underlying table.

If you want to be able to add new things to the combobox from your form, make sure the Limit to List setting in the combobox properties is set to No.

Hope this helps. (And I hope I have understood your problem)
 
Hi Some Guy,

I tried to follow all the steps that you said... but the combo box doesn't pull the existing records from the table..do I have to create a query that consist of all the record's fields...

thanks,
 
Yes, I would create a query based on the field in my table that I want in my drop down list (run the query after to ensure that it actually works!).

For example. Your table has employee records and a form that is based on this table. When you make an entry in a field on your form, the info is then stored in your underlying table.
Now say you want a combobox that allows you to pick an employee's name. You could make a query that filters out the employees' names from your employee table (or if you have another table with this info in it you can use that instead). This is the query that you would base your combobox on when the wizard prompts you for the source of the combobox.

Depending on your application, you may need to include the employee id in the query but that is another story.

Hope this helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top