Hello, I am encountering an error whenver I try to run the datediff function in an access report. Its in the detail on format event. Can you not run this function during this event? The error I’m getting is Run-Time Error 5: Invalid Procedure call or argument.
Here’s my code:
——————————–
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim intAssetLife As Double
Dim POD As Date
Dim FYEnd As Date
Dim txtFYEnd As String
POD = Me.AcquisitionDate.Value
txtFYEnd = Me.FYEndDate.Value
FYEnd = CDate(txtFYEnd)
‘Debug.Print FYEnd
Me.txtAssetAge.Value = DateDiff(yyyy, POD, FYEnd)
End Sub
Thanks for any help someone can provide.