Coding in a subform in response to an event

G

Guest

I am a new comer...I am building a form with a subform. In the subform, when
a conditional event occurs, like the number entered is more than 12, the
number turns red and a msgBox pops up with a warning. Here is the code:

Private Sub strHGB_BeforeUpdate(Cancel As Integer)
With Me!strHGB
If (.Value >= 12) Then
Me!strHGB.ForeColor = 255
MsgBox "Review DOQI Guidelines for HGB >= 12."
Else
Me!strHGB.ForeColor = 0
End If
End With

End Sub--

My problem is that the forecolor change does not occur in the subform
(datasheet view). It will turn red in form view or continuous view, but only
the msgBox comes up in datasheet. Is there any way to fix this? Thank you.
Kbelo
 
S

Scott McDaniel

My problem is that the forecolor change does not occur in the subform
(datasheet view). It will turn red in form view or continuous view, but only
the msgBox comes up in datasheet. Is there any way to fix this? Thank you.

Formatting of individual textboxes in a Datasheet or Continuous view Form is normally done with Conditional Formatting.
Click on the control in Design view, then select Format - Conditional Formatting from the menu. See the online help
topic for information on using CF.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 
G

Guest

Thank you!..it worked perfectly.
--
Kbelo


Scott McDaniel said:
Formatting of individual textboxes in a Datasheet or Continuous view Form is normally done with Conditional Formatting.
Click on the control in Design view, then select Format - Conditional Formatting from the menu. See the online help
topic for information on using CF.

Scott McDaniel
scott@takemeout_infotrakker.com
www.infotrakker.com
 

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