Solved date() - 1 as default value in a text box control (1 Viewer)

AnilBagga

Member
Local time
Tomorrow, 05:13
Joined
Apr 9, 2020
Messages
223
I would like the default value of a text box to display default date()-1

I tried following expressions in the default control source

=Date()-1
=dateadd("d",-1,date())

Both don't work. I don't get an error, but the displayed date is always the date()

Why don't these expressions work?
 

Minty

AWF VIP
Local time
Today, 23:43
Joined
Jul 26, 2013
Messages
10,355
A default value is different to a Control source? Which is it as your post seems to describe a bit of each.

A default value for yesterday would be

Date() - 1
 

theDBguy

I’m here to help
Staff member
Local time
Today, 16:43
Joined
Oct 29, 2018
Messages
21,358
Hi. Either =Date()-1 or just Date()-1 should work. But as @Minty said, you will only see it displayed for new records.
 

AnilBagga

Member
Local time
Tomorrow, 05:13
Joined
Apr 9, 2020
Messages
223
Hi. Either =Date()-1 or just Date()-1 should work. But as @Minty said, you will only see it displayed for new records.
Thanks. I had the formulae in place. I did not realise that it would work only in new records.
 

Minty

AWF VIP
Local time
Today, 23:43
Joined
Jul 26, 2013
Messages
10,355
If you want to fill it out for existing blank records you would need to run an update query.
 

Users who are viewing this thread

Top Bottom