Null date parameter

  • Thread starter Thread starter John
  • Start date Start date
hi John,
How can I pass a null value to a date parameter in a Sub?
you have to pass it as Varian as normal data types cannot be Null:

Public Sub yourSub(ADateNullable As Variant)

On Local Error GoTo LocalError

Dim DateValue As Date

If IsNull(ADateNullable) Then
Else
DateValue = CDate(ADateNullable)
End IF

Exit Sub

LocalError:
If Err.Number = 13 Then
' Type mismatch.
End If

End Sub



mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top