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])
Microsoft Access

Avatar of undefined
Last Comment
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
dqmq

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
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

How would me.[LastDateCompleted] work in Conditional Formatting, if that is what you are saying ?

mx
dqmq

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.



Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)

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

mx