If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Using a combo box as a criteria for a query
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) |
#2
|
|||
|
|||
Using a combo box as a criteria for a query
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. -- Build a little, test a little. "neetkleat" wrote: 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) |
Thread Tools | |
Display Modes | |
|
|