Combo box refresh problem

  • Thread starter Thread starter Russ
  • Start date Start date
R

Russ

I have two combo boxes: "DayShift" and "NightShift". The
values are (1) and (2) for "DayShift", and (3) and (4)
for "NightShift.
What I'd like to see is if the value of (1) is selected in
combo box: "DayShift" I'd like for the only selection in
combo box: "NightShift" to be (4)

The same should be true for if "DayShift" value is (2),
the only available value in combo box "NightShift" should
be (3).


With that in mind my statment looks something like this:

IIf([Forms]![frm_RoboCoater_3_Rinse_Tank_Temperature]!
[cboDayShift]=1,4,3)

I have a "Me.cboNightShift.Requery" in the "cboDayShift"
AfterUpdate event procedure.

Now, When I select an "A" value in the cboDayShift combo
box, only a "C" shows up in the "cboNightShift" value
list, it should be a "D" or a "C" if the value selected in
the "cboDayShift" was a "B".

Any ideas for a solutions to this sticky issue?
 
Add this table to your database:

TblShift
ShiftID
DayShift
NightShift

Create two records in the table:
1 1 4
2 2 3

Base your DayShift Combobox on TblShift. Set the bound column to 1, column count
to 2 and column widths to 0;.5.

Create a query called QryNightShift and include all the fields in TblShift. Sort
ascending on the night shift field. Set the bound column to 1, column count to 3
and column widths to 0;0;.5. Enter this expression in the criteria of the
DayShift field:

Forms!NameOfYourForm!NameOfYourDayShiftCombobox Or
(Forms!NameOfYourForm!NameOfYourDayShiftCombobox Is Null)

If you pick 1 for Dayshift, you'll only be able to pick 4 for NightShift.
If you pick 2 for Dayshift, you'll only be able to pick 3 for NightShift.
If you don't make any pick for Dayshift, you'll be able to pick 3 or 4 for
NightShift.

PC DataSheet
Your Resource For Help With Access, Excel and Word Applications
www.pcdatasheet.com
 
Change the records in the table to:
1 A D
2 B C

and follow my previous directions and you'll get what you want!

PC Datasheet
www.pcdatasheet.com



Russ said:
This is exactly what I have done. I have a table as you
suggested, using a query behind the dropdowns: cboDayShift
and cboNightShift. The recordset is limited in cboDayShift
to a numeric value of 1 and 2 for "cboDayShift", and 3 and
4 for "cboNightShift".

I need to pick a value for the cboDayShift of 1 "A" or
2 "B", which should or will then allow only a "D" in
cboNightShift if cboDayShift = "A", or cboNightShift = "C"
if cboDayShift= "B".

In other words limit the data selection in "cboNightShift"
based on the content of "cboDayShift"

Hope this helps......

-----Original Message-----
Add this table to your database:

TblShift
ShiftID
DayShift
NightShift

Create two records in the table:
1 1 4
2 2 3

Base your DayShift Combobox on TblShift. Set the bound column to 1, column count
to 2 and column widths to 0;.5.

Create a query called QryNightShift and include all the fields in TblShift. Sort
ascending on the night shift field. Set the bound column to 1, column count to 3
and column widths to 0;0;.5. Enter this expression in the criteria of the
DayShift field:

Forms!NameOfYourForm!NameOfYourDayShiftCombobox Or
(Forms!NameOfYourForm!NameOfYourDayShiftCombobox Is Null)

If you pick 1 for Dayshift, you'll only be able to pick 4 for NightShift.
If you pick 2 for Dayshift, you'll only be able to pick 3 for NightShift.
If you don't make any pick for Dayshift, you'll be able to pick 3 or 4 for
NightShift.

PC DataSheet
Your Resource For Help With Access, Excel and Word Applications
www.pcdatasheet.com





Russ said:
I have two combo boxes: "DayShift" and "NightShift". The
values are (1) and (2) for "DayShift", and (3) and (4)
for "NightShift.
What I'd like to see is if the value of (1) is selected in
combo box: "DayShift" I'd like for the only selection in
combo box: "NightShift" to be (4)

The same should be true for if "DayShift" value is (2),
the only available value in combo box "NightShift" should
be (3).


With that in mind my statment looks something like this:

IIf([Forms]![frm_RoboCoater_3_Rinse_Tank_Temperature]!
[cboDayShift]=1,4,3)

I have a "Me.cboNightShift.Requery" in the "cboDayShift"
AfterUpdate event procedure.

Now, When I select an "A" value in the cboDayShift combo
box, only a "C" shows up in the "cboNightShift" value
list, it should be a "D" or a "C" if the value selected in
the "cboDayShift" was a "B".

Any ideas for a solutions to this sticky issue?


.
 
Back
Top