Multiple criteria from a textbox?

G

Guest

Hi all. I could really use some help on this one!

I have a switchboard form that's set up with 1 combo box.
The values in the combo box represent cost centers.
I have the form password protected so that when a manager selects their cost
center and gives the correct password, they are taken to a second switchboard
where they can pull various reports for their team.

I populate a hidden textbox with the value from the combo box so the main
switchboard form can be closed. Then I reference the textbox value in the
queries' cost center criteria field so that they only see information for
their own cost centers.
(ex/ If the cost center is 08X, the textbox value = "08X". The query
references the textbox in the criteria field.)
And this works GREAT if there's only one cost center.

My issue is I don't know how to code it so that the textbox can equal more
than one cost center at the same time.
For instance, under a certain cost center (10X) there are 3 other cost
centers that report to it (01X,02X,05X).
How can I code it so that the textbox value gets referenced in the query
criteria field as "01X" Or "02X" Or "5X"?

Thanks for your help!
 
G

Guest

Use a cross reference table [CostCTR X-Ref] Like this --
MainCostCTR SubCostCTR
08X 08X
10X 10X
10X 01X
10X 02X
10X 05X

Use this query and edit it for your fields --
SELECT KNIA_Table.x, KNIA_Table.CostCTR, [CostCTR X-Ref].MainCostCTR
FROM [CostCTR X-Ref], KNIA_Table
WHERE (((KNIA_Table.CostCTR)=[CostCTR X-Ref].[SubCostCTR]) AND (([CostCTR
X-Ref].MainCostCTR)=[Forms]![YourFormName]![YourTextBox]));
 
G

Guest

Bless you Karl. You make it look so easy :)

KARL DEWEY said:
Use a cross reference table [CostCTR X-Ref] Like this --
MainCostCTR SubCostCTR
08X 08X
10X 10X
10X 01X
10X 02X
10X 05X

Use this query and edit it for your fields --
SELECT KNIA_Table.x, KNIA_Table.CostCTR, [CostCTR X-Ref].MainCostCTR
FROM [CostCTR X-Ref], KNIA_Table
WHERE (((KNIA_Table.CostCTR)=[CostCTR X-Ref].[SubCostCTR]) AND (([CostCTR
X-Ref].MainCostCTR)=[Forms]![YourFormName]![YourTextBox]));


KNIA said:
Hi all. I could really use some help on this one!

I have a switchboard form that's set up with 1 combo box.
The values in the combo box represent cost centers.
I have the form password protected so that when a manager selects their cost
center and gives the correct password, they are taken to a second switchboard
where they can pull various reports for their team.

I populate a hidden textbox with the value from the combo box so the main
switchboard form can be closed. Then I reference the textbox value in the
queries' cost center criteria field so that they only see information for
their own cost centers.
(ex/ If the cost center is 08X, the textbox value = "08X". The query
references the textbox in the criteria field.)
And this works GREAT if there's only one cost center.

My issue is I don't know how to code it so that the textbox can equal more
than one cost center at the same time.
For instance, under a certain cost center (10X) there are 3 other cost
centers that report to it (01X,02X,05X).
How can I code it so that the textbox value gets referenced in the query
criteria field as "01X" Or "02X" Or "5X"?

Thanks for your help!
 

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