Conditional Formatting

M

Majic

Hey guys,
I have a field in the subform that I would to change color after
validating the item number.
I am already using conditional formatting, but the problem it only
limits you to 3 conditional formatting.
I need to have additional conditional formatting so a total of 4
conditional formatting.

Field called "Item1", this item has 4 different format for example:
19204444 "MITM" Field Value is, equal to, MITM (Green)
19-204-444 "Item" Field Value is, equal to, Item
(Green)
P19204444 "PItem" Field Value is, equal to, PItem (Green)
D19-204-444 "DItem Field Value is, equal to, DItem
(Green)

All the above items are the same number and I am validating those
numbers, if it is the number is correct then color turn green and if
it not correct it will turn red.

Or, how could I combine all the four since I am validating against one
number "Item" in one condition by using "expression is"?

Please help me solve this issue

Thank you
 
W

Wayne-I-M

Private Sub TextBoxNmae_AfterUpdate()
If Me.TextBoxNmae = "MITM" Then
Me.TextBoxNmae.BackColor = vbGreen
ElseIf Me.TextBoxNmae = "Item" Then
Me.TextBoxNmae.BackColor = vbRed
ElseIf Me.TextBoxNmae = "PItem" Then
Me.TextBoxNmae.BackColor = vbGreen
ElseIf Me.TextBoxNmae = "DItem" Then
Me.TextBoxNmae.BackColor = vbRed
Else
Me.TextBoxNmae.BackColor = vbWhite
End If
End Sub
 
M

Majic

Private Sub TextBoxNmae_AfterUpdate()
If Me.TextBoxNmae = "MITM" Then
Me.TextBoxNmae.BackColor = vbGreen
ElseIf Me.TextBoxNmae = "Item" Then
Me.TextBoxNmae.BackColor = vbRed
ElseIf Me.TextBoxNmae = "PItem" Then
Me.TextBoxNmae.BackColor = vbGreen
ElseIf Me.TextBoxNmae = "DItem" Then
Me.TextBoxNmae.BackColor = vbRed
Else
Me.TextBoxNmae.BackColor = vbWhite
End If
End Sub

--
Wayne
Manchester, England.










- Show quoted text -

Thank you but it did not work. It did not change color. I am going
to keep trying and see why it is not working.

Since the field name is Item1, here is what I did for just one in
order to test it (that is for just PItem):

Private Sub Item1_AfterUpdate()
If Me.Item1 = "PItem" Then
Me.PItem.BackColor = vbGreen
Item1 = ""

If IsNull(ScannedQty1) = True Then ScannedQty1 = 0

Me.AfterInsert = True

ScannedQty1.SetFocus
ScannedQty1 = ScannedQty1 + 1

Item1.SetFocus
If ScannedQty1 = Qty Then
Item1.SetFocus
Item1 = PItem

ScannedQty1.SetFocus
SendKeys ("{tab}")
End If
End If
End Sub

Please let me know what I did wrong

Thank you
 
W

Wayne-I-M

--
Wayne
Manchester, England.



Majic said:
Thank you but it did not work. It did not change color. I am going
to keep trying and see why it is not working.

Since the field name is Item1, here is what I did for just one in
order to test it (that is for just PItem):

Private Sub Item1_AfterUpdate()
If Me.Item1 = "PItem" Then
Me.PItem.BackColor = vbGreen
Item1 = ""

If IsNull(ScannedQty1) = True Then ScannedQty1 = 0

Me.AfterInsert = True

ScannedQty1.SetFocus
ScannedQty1 = ScannedQty1 + 1

Item1.SetFocus
If ScannedQty1 = Qty Then
Item1.SetFocus
Item1 = PItem

ScannedQty1.SetFocus
SendKeys ("{tab}")
End If
End If
End Sub

Please let me know what I did wrong

Thank you

You say that
Field called "Item1", this item has 4 different format for example:
"DItem
"MITM"
"Item"
"PItem"
It so what are these

D19-204-444
19204444
19-204-444
P19204444
D19-204-444

Condidtional formating is simple
if some is true then do this
if it's not then either do nothing or do something else

have a look at the code and gave and use it with some change to get it to
format as you want.

Sorry but I don't understand the "if it's true" section of what you are
trying to do
 
M

Majic

--
Wayne
Manchester, England.

















You say that
Field called  "Item1", this item has 4 different format for example:
"DItem    
"MITM"  
"Item"  
"PItem"


It so what are these

D19-204-444
19204444
19-204-444  
P19204444
D19-204-444

Condidtional formating is simple
if some is true then do this
if it's not then either do nothing or do something else

have a look at the code and gave and use it with some change to get it to
format as you want.

Sorry but I don't understand the "if it's true" section of what you are
trying to do- Hide quoted text -

- Show quoted text -

Yes that is correct. Item 1 = 1934040000A = D19-34040-000A =
P1934040000A = 19-34040-000A
Because we are using different supplier and each have different
formats.

Thank you so much
 

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