"Invalid use of Null" issue

  • Thread starter Thread starter Mark
  • Start date Start date
M

Mark

Hi all,

How can I keep from getting the "Invalid use of Null" error if the
dateofReferral is indeed null?

vRefDate = DLookup("[dateofreferral]", "tbdetail", "RecordID =
Forms![frmain]!cbPatientList")
 
Hi all,

How can I keep from getting the "Invalid use of Null" error if the
dateofReferral is indeed null?

vRefDate = DLookup("[dateofreferral]", "tbdetail", "RecordID =
Forms![frmain]!cbPatientList")

Dim vRefDate as a Variant. How is it dimensioned at present?

Or you could use the NZ() function to return some arbitrary date.
 
Try

vRefDate = NZ(DLookup("[dateofreferral]", "tbdetail", "RecordID =
Forms![frmain]!cbPatientList"),"")

(Will return "" if Null without error I think)
 
Hi all,

How can I keep from getting the "Invalid use of Null" error if the
dateofReferral is indeed null?

vRefDate = DLookup("[dateofreferral]", "tbdetail", "RecordID =
Forms![frmain]!cbPatientList")

Marc;
You can code using an Iff function as in
vRefdate=Iff(isnull(DLookup-------------)truevalue, false value)
 
Back
Top