Access VBA Error - TechRepublic
Question
February 9, 2009 at 09:38 AM
omnknt232006

Access VBA Error

by omnknt232006 . Updated 17 years, 4 months ago

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.

This discussion is locked

All Comments