Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional format in a continuous form not working

Status
Not open for further replies.

PeDa

Technical User
Oct 10, 2002
227
NL
In a continuous form I am trying to change the ForeColor of [aAudit_d] depending on the values of [aAudit_d] (a date) and [IsPlan] (0 or 1).
My Form_Load event contains the following:

Code:
Me![aAudit_d].FormatConditions.Delete
Set objFrc = Me![aAudit_d].FormatConditions.Add(acExpression, , Me![IsPlan] = 0)
Set objFrc = Me![aAudit_d].FormatConditions.Add(acExpression, , Me![IsPlan] = 1 And Me![aAudit_d] >= Now())
Set objFrc = Me![aAudit_d].FormatConditions.Add(acExpression, , Me![IsPlan] = 1 And Me![aAudit_d] < Now())
With Me![aAudit_d].FormatConditions(0)
  .FontBold = False
  .ForeColor = RGB(255, 255, 255) 'has been carried out; black
End With
With Me![aAudit_d].FormatConditions(1)
  .FontBold = False
  .ForeColor = RGB(255, 165, 0) 'planned, but in the future; orange
End With
With Me![aAudit_d].FormatConditions(2)
  .FontBold = True
  .ForeColor = RGB(255, 0, 0) 'planned in the past but not carried out; red
End With

However the ForeColor of all records is Orange, independent of the values of [aAudit_d] and [IsPlan]. What as I doing wrong?
 
What about this ?
Set objFrc = Me![aAudit_d].FormatConditions.Add(acExpression, , "[IsPlan] = 0")
Set objFrc = Me![aAudit_d].FormatConditions.Add(acExpression, , "[IsPlan] = 1 And [aAudit_d] >= Now()")
Set objFrc = Me![aAudit_d].FormatConditions.Add(acExpression, , "[IsPlan] = 1 And [aAudit_d] < Now()")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV said:
Code:
Set objFrc = Me![aAudit_d].FormatConditions.Add(acExpression, , "[IsPlan] = 0")
Set objFrc = Me![aAudit_d].FormatConditions.Add(acExpression, , "[IsPlan] = 1 And [aAudit_d] >= Now()")
Set objFrc = Me![aAudit_d].FormatConditions.Add(acExpression, , "[IsPlan] = 1 And [aAudit_d] < Now()")

Yes indeed; that dit the trick. Many thanks,
Peter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top