Simple Vb Code Help

mosh

Registered User.
Local time
Today, 10:14
Joined
Aug 22, 2005
Messages
133
Hello All,

I have a subform with a field that counts the number of agents off per team. I want to create a peice of vb code where If the department contains the letters "one" And the count is more than 1 to highlight the text box.

I have the following written;

Private Sub CountOfpayroll_number_AfterUpdate()
If [CountOfpayroll_number] >1 And SectionManager.Value = Then
CountOfpayroll_number.ForeColor = vbRed
CountOfpayroll_number.FontWeight = 700
Else
CountOfpayroll_number.ForeColor = vbBlack
CountOfpayroll_number.FontWeight = 400

End If
End Sub

The above is wrong as Im sure I need to declare a string but confused on how to.

Thanks for your help

Mos
________
Extreme vaporizer q review
 
Last edited:
Try the following

Private Sub CountOfpayroll_number_AfterUpdate()
If [CountOfpayroll_number] >1 And SectionManager.Value Like "*one*" = True Then
CountOfpayroll_number.ForeColor = vbRed
CountOfpayroll_number.FontWeight = 700
Else
CountOfpayroll_number.ForeColor = vbBlack
CountOfpayroll_number.FontWeight = 400

End If
End Sub
 
thank you.
mos
________
How To Roll Blunts
 
Last edited:

Users who are viewing this thread

Back
Top Bottom