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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a select query on combo box contents

Status
Not open for further replies.

santastefano

Programmer
Aug 9, 2005
54
IT
Good morning (at least in Italy)
I have used a combo box to retrieve data from a table and implemented the Access 2000 Developers Handbook not in list solution. Works perfectly but....
Later I want to use the contents of the combo box as the basis of a select query and the query does not return anything.
If I run the query with the form closed and enter the criteria it works.
Is it possible to base a select query on the contents of a combo box?
(The combo box has one bound column to return the required data for the user)
Thanks
 
Yes it is possible. An example of the SQL would look like:
[tt]SELECT tblPersons.PersonsKey, tblPersons.Forename, tblPersons.Surname
FROM tblPersons
WHERE (((tblPersons.PersonsKey)=[Forms]![frmForm]![cboCombo]))[/tt]

This example illustrates a two column combo where a name is shown to the user and a hidden bound column is used in the query.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top