fore color-continuous form

J

Junior

Acc2K -Using a continuous form - i want to change the color of a txt box
(date) to red if the date is greater than another date txtbox - i put this
code in the forms current event - but this changes all txtcompl to red
what am i doing wrong?? thanks

Dim dtComp As Date, dtSusp As Date
dtComp = Nz(Me!txtCompl, 99) 'date complete
dtSusp = Nz(Me!txtsusp, 99) 'due date

If dtComp = 99 or dtComp > dtSusp Then
[txtCompl].ForeColor = vbRed
End If
 
G

Graham Payton

Hi


This is very confusing when you first try to do it.

You need to use something called "Conditional Formatting". This is found
under the "Format" menu when you have your form open in design view.

Hope this helps


Graham
 
D

DanK

OK so you have the code to tell the field to turn red, but
where's the code to tell it to turn BACK TO white/black or
whatever? Once it turns the field red, they're ALL red
because you haven't told it to do otherwise.
 
D

DanK

You also have to put the code in the On Format or On Print
property of the Form/Report.
 

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