Link to home
Start Free TrialLog in
Avatar of AkAlan
AkAlan

asked on

Access Textbox Conditional Formatting based on other Textbox value

I ave an access form with two date textboxes and I want one textbox to display the current date if another textbox is NULL. I have made several attempts but can't get this to work. Here is what I think should work but doesn't:

In the textbox NextDueDate I put this in the expression box after Expression Is:

IIf(IsNull([LastDateCompleted]),Now(),[NextDueDate])
Also
IIf(IsEmpty([LastDateCompleted]),Now(),[NextDueDate])
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Unless it's a bound control, in which case you may want a variation of that code in the appropriate event (current? after_update? before_insert?)

If (IsNull(me.[LastDateCompleted]) then
     [NextDueDate] = now()
end if
How would me.[LastDateCompleted] work in Conditional Formatting, if that is what you are saying ?

mx
mx,
Not sure I understand your question.  It's not Conditional Formatting in the sense that I normally use the term (changing visual properties of a control based on it's contents).  I'm just changing the value of one control (and its underlying field in the case of a bound column) based on the contents of another.

I wasn't disputing your answer, just offering an alternative in case the Control Source was tied to a field in the recordsource.  I see you got the points, so I guess your solution was on the mark.



Sorry ... misread what you were saying ...

mx