Problem setting a Date for locar variable (1 Viewer)

drb75088

New member
Local time
Today, 06:10
Joined
Nov 18, 2016
Messages
8
In an OnInsert macro I want to set a local variable to a date one day previous to the date in the current item being inserted.

Table is Absences, date field is AbsenceDate. AbsenceDate type is short date.

Variable will be used as a parameter to a Data Macro.
 

Ranman256

Well-known member
Local time
Today, 09:10
Joined
Apr 9, 2015
Messages
4,339
Date math is done with DateAdd...

NewDate= dateAdd("d",-1,currentDate)
 

MarkK

bit cruncher
Local time
Today, 06:10
Joined
Mar 17, 2004
Messages
8,178
And an additional shortcut, since dates are stored as numbers in a scheme such that 1 day = 1.0, you can also just do...
Code:
NewDate = currentDate - 1
[COLOR="Green"]'or[/COLOR]
Yesterday = Date() - 1
 

drb75088

New member
Local time
Today, 06:10
Joined
Nov 18, 2016
Messages
8
Thanks, but tried that in every way I could think of.
Here is what I have:

SetLocalVar
Name lvarDate
Expression =DateAdd("d",-1,[Absences].AbsenceCode]

Expression builder accepts it, but when saved I receive

The SetLocalVar macro action has an invlid value for the 'Expression" argument.
 

drb75088

New member
Local time
Today, 06:10
Joined
Nov 18, 2016
Messages
8
Found it. Replaced "d" with Day.:)

Thought I had tried that before posting.
 

Users who are viewing this thread

Top Bottom