ACC95: DateDiff, DateAdd, or DatePart Causes IPF in VBA232.DLLID: Q169156
|
Moderate: Requires basic macro, coding, and interoperability skills.
When you pass an uninitialized string variable to the interval argument of
the DateAdd(), DatePart(), or DateDiff() functions in Microsoft Access 7.0,
you receive the following error message:
MSACCESS caused an invalid page fault in module VBA232.DLL
Always pass a valid interval value to the DateAdd(), DatePart(), and
DateDiff() functions. To be sure you pass a valid interval value, you can
test for the value of the variable before you invoke the function, as in
the following example:
Sub IntervalTest()
Dim x as String
If x <> "" Then
Debug.Print DateAdd(x,1,Date)
Else
MsgBox "The interval argument is invalid."
End If
End Sub
Sub IntervalTest()
Dim x as String
x = ""
' Add other code here that sets the value of x
Debug.Print DateAdd(x,1,Date)
End Sub
Run-time error '5':
Invalid procedure call
Microsoft has confirmed this to be a problem in Microsoft Access 7.0. This behavior does not occur in Microsoft Access 2.0 or 97.
Sub Test()
Dim x as String
Debug.Print DateAdd(x,1,Date)
End Sub
For more information about DateAdd(), DatePart(), or DateDiff() functions, ask the Microsoft Access 7.0 Answer Wizard for "date functions."
Keywords : kberrmsg kbprg MdlGnrl
Version : 7.0
Platform : WINDOWS
Issue type : kbbug
Last Reviewed: April 16, 1999