Similar problem here:
windows 7 - Error calling dateadd function - Stack Overflow[
^]
Example correct usage:
Option Explicit
Private Sub Command1_Click()
Dim datNow As Date
Dim datYesterday As Date
datNow = Now
datYesterday = DateAdd("d", -1, datNow)
Print "Yesterday = " & CStr(datYesterday)
End Sub
Private Sub Form_Load()
MsgBox (DateAdd("d", -1, Now))
End Sub
Refer:
[MS-VBAL]: DateAdd | Microsoft Docs[
^]
Function DateAdd(Interval As String, Number As Double, Date As Variant)
Once you have the desired date, convert that into a format needed.