Using a combo box as a criteria for a query

N

neetkleat

I have 2 tables:

Table 1 = Position Names
PositionID - Data Type = AutoNumber
Position Name - Data Type = Text

Table 2 = Staff Positions
StaffID - Data Type = AutoNumber
Last Name - Data Type = Text
First Name - Data Type = Text
Position Name - Data Type = Number, Display Control = Combo Box, Row Source
Type = Table/Query, Row Source = SELECT [Position Names].PositionID,
[Position Names].[Position Name] FROM [Position Names] ORDER BY [Position
Name];

I am trying to create a query that will show the Last Name and First Name of
all staff who hold the position "General Staff".

Unfortunately when I try to use the combo box Position Name from the Staff
Positions table, it says there is a Data type mismatch, since under criteria,
I wrote in "General Staff".

I understand that it is a number since it is a combo box, but how do I get
it to query the Staff Positions table?

(Please let me know if you need any more details, I know that wasn't the
most clear description)
 
K

KARL DEWEY

You form that the criteria combo is on must be open and a selection made or a
default applied. For criteria referer to the combo in this manner --
[Forms]![YourCriteriaFormName]![ComboName]

You would open the form and select "General Staff" in the combo and then run
the query, either directly or by opening a dispaly form or report.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top