"Invalid use of Null" issue

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")
 
J

John W. Vinson

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.
 
M

MikeJohnB

Try

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

(Will return "" if Null without error I think)
 
R

richaluft

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)
 

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

Top