A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Using a combo box as a criteria for a query



 
 
Thread Tools Display Modes
  #1  
Old April 19th, 2010, 07:08 PM posted to microsoft.public.access.queries
neetkleat
external usenet poster
 
Posts: 5
Default 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  
Old April 19th, 2010, 07:15 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 05:56 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.