Writing conditional formatting

L

Lavendarladyd

I need to write conditional formatting for some of my combo boxes. I need
for one drop down to only show certain options depending on what is selected
in another drop down.

Ex. If "Blend Line" is selected for Machine Area, I need my OEM to only
allow me to choose from 3 choices....If "Winderhead is selected in Machine
Area...there should be 2 different choices available in the OEM box.

Please help!! I know it has to be possible to do, but just can't seem to
figure it out. Thanks!
 
S

scubadiver

If there was an FAQ section, "Cascading Combo's" would be in it !

All you have to do for the second combo is create a query with the two
fields (machine and OEM) and insert a criteria line in the "machine" field
that references the first combo.

[forms]![form name]![combo1]

In the first combo insert the following into the "after update" event.

combo2.requery

let me know.
 
B

BruceM

Conditional formatting is when you change the font color if the value is
above a certain amount, or something like that. As scubadiver pointed out,
you want what is known as cascading combo boxes.

Here is a link to an article that explains the proces in more detail:
http://www.mvps.org/access/forms/frm0028.htm

How you proceed depends on the details. What exactly do you mean by "I need
my OEM to only allow me to choose from 3 choices"? Is the OEM making the
choices, or are you selecting an OEM based on what is selected in the
MachineArea combo box? What is it about the "Blend Line" selection that
limits the list in the other combo box? Is Blend Line associated only with
certain OEMs?
 
L

Lavendarladyd

Thank you to both of you for trying to help me figure this one out.
Yes, I need the box to allow them to only select an OEM based on what is
selected in the Machine Area combo box.

Actually, what is selected in the "Machine Area" and "Line #" boxes should
determine what options they have to select in the OEM box. There are only
certain OEM's which associate with different Machine Areas & Line#'s.
Technically I need them to select the Machine area first, then the Line#.
Depending on what is selected in these 2 boxes will determine what options
they have to select from in the OEM box.

Does this make more sense now? I hope so.
 
B

BruceM

It sounds as if you need a table for OEMs, with fields for MachineArea and
LineNumber:

tblOEM
OEM_ID (number)
OEM_Name (text)
MachineArea (text)
LineNumber (text)

Also, I expect there would be a MachineArea table. This tblOEM would
probably be related one-to-many with tblMachineArea (one OEM may have
several MachineAreas), but there is too little information to be sure.
Remember that those of us reading your question are not familiar with the
real-world situation for which the database is intended, nor can we see the
database.

The MachineArea combo box would have a means of selecting a value. It may
be from a table, or from a value list, depending on how many there are, your
preferences, etc. I will assume that the cboMachineArea combo box has a
single field: MachineArea. The After Update event for cboMachineArea would
be something like:

Dim strSQL as String
strSQL = "SELECT OEM_ID, OEM_Name FROM " & _
"tblOEM WHERE MachineArea = " " " & _
Me.cboMachineArea & " " " "
Me.cboOEM.RowSource = strSQL

Note that the line breaks (& _) are for convenience only, and that you don't
need to put the spaces between the quote marks. I added them for clarity.
The code assumes that MachineArea is a text field.
This code says, in effect: "Select records from tblOEM in which the
MachineArea field is the same as the MachineArea field selected in the combo
box."
 
L

Lavendarladyd

Thanks for all your help. I have figured out the code by searching a lot of
areas. It is working great now. The sight that ended up helping me the most
was...

http://www.fontstuff.com/access/acctut10.htm

Maybe this will help someone else if they run into the same situation that I
have.

Thanks again for all your help :)
 
B

BruceM

I have added that link to my Favorites. One of the difficulties in trying
to answer questions is understanding what structure/situation underlies the
problem. Since you (and many people asking questions) already know that
information, an explanation that encompasses several options should prove
helpful.
 
Top