Hi everyone,
I´m having a little trouble with the Date Add function in a query criteria and would appreciate any kind of help:
I have English Ms Access and my local time configuration in spanish (Chile). I use 31-01-2018 for January 1st, 2018.
In a query criteria when i use:
<CDate([Forms]![frm_lease]![txt_lease_renovation_date]) it has no problems and it works fine.
The thing is when in the criteria I´m adding the DateDiff function. I only need to substract one day from [txt_lease_renovation_date] so i use the following:
<DateAdd("d",-1,CDate([Forms]![frm_lease]![txt_lease_renovation_date]))
Then access returns an error : "The expression you entered contains invalid syntax. You may have entered an operand without operator.
I have vba code in other forms of this database where i´m ussing DateAdd and DateDiff and it works fine; but this error can´t figure it out.
I´ve tried single quotation, tried not to use the Cdate function, tried to use brackets.
The strange thing is with the DateAdd function in the query criteria, because the Cdate worked well.
I think this kind of basic problem but i would happy if any of you guys can look at it.
Thanks a lot!
I´m having a little trouble with the Date Add function in a query criteria and would appreciate any kind of help:
I have English Ms Access and my local time configuration in spanish (Chile). I use 31-01-2018 for January 1st, 2018.
In a query criteria when i use:
<CDate([Forms]![frm_lease]![txt_lease_renovation_date]) it has no problems and it works fine.
The thing is when in the criteria I´m adding the DateDiff function. I only need to substract one day from [txt_lease_renovation_date] so i use the following:
<DateAdd("d",-1,CDate([Forms]![frm_lease]![txt_lease_renovation_date]))
Then access returns an error : "The expression you entered contains invalid syntax. You may have entered an operand without operator.
I have vba code in other forms of this database where i´m ussing DateAdd and DateDiff and it works fine; but this error can´t figure it out.
I´ve tried single quotation, tried not to use the Cdate function, tried to use brackets.
The strange thing is with the DateAdd function in the query criteria, because the Cdate worked well.
I think this kind of basic problem but i would happy if any of you guys can look at it.
Thanks a lot!