Conditional Formatting Question

Just1

Registered User.
Local time
Yesterday, 17:58
Joined
Jan 9, 2005
Messages
50
I have a form where it is important for the user to know whether or not to contact an employer. If the data entered in the "Contact Employer" field states "No", I would like the next person to go into this screen to be fully alerted to this, ie. say, change the background colour of the whole form, or to flash up a new text box to say "Do Not Contact!" until the field is changed to state yes again.

Any help appreciated.
Thanks
Just1
 
Code:
Private Sub Form_Current()
 If Me.ContactEmployer = "No" Then
   MsgBox "Do Not Contact This Employer!"
 End If
End Sub

or
Code:
Private Sub Form_Current()
 If Me.ContactEmployer = "No" Then
   Me.Detail.BackColor = vbRed
 Else
  Me.Detail.BackColor = -2147483633 'Standard Access gray
End If
End Sub
 
Thanks.

BUT...when I go to open up the form, the message box now flashes up before I actually get into the form. This happens if my first record shows a "No"....

?
Thanks
Just1
 
Sorry, didn't realize the messagebox would fire before the data came up. Changing the background color works, regardless of the value in the first record, or you could replace the messagebox with a label, which actually might be better; it won't require the user to click to get rid of it! You can also format the label, color-wise, to be noticeable.

Where the label's name is DoNotCallLabel.

Code:
Private Sub Form_Current()
 If Me.ContactEmployer = "no" Then
   DoNotCallLabel.Visible = True
 Else
   DoNotCallLabel.Visible = False
End If
End Sub
 

Users who are viewing this thread

Back
Top Bottom