MS Access code update that will allow identifation of blank or null values during import

Hello Experts.  I need your help to change the below Function code to also allow for null or blank values.  Currently the code updates chk1 to True when there is a date, but does not update chk1 to True when null or blank.

Function chk1(A As String) As Boolean
'Check date
Dim i As Integer, l As Integer, c As String
A = Trim(A) 'remove possible spaces
chk1 = False
If IsDate(A) Then chk1 = True
If IsNull(A) Then chk1 = True    'I inserted this line, but it does not work

End Function
Who is Participating?
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Strings can't accept a null value (only a zero-length string or an actual string), so:

Function chk1(varInputDate As Variant) As Boolean

  'Check date
   If IsNull(varInputDate ) or IsDate(varInputDate) then Chk1 = True

End Function
Are you really intending to change the value of A in the calling procedure?

By default, arguments are passed by reference (ByRef) that means a pointer is passed rather than a copy of the variable.  So, your code when it changes A, is changing A in the calling procedure.
dhempleAuthor Commented:
Thank you for your assistance with this question.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.