Reputation: 3
I'm trying to use the DLookup function and it keeps giving me a type mismatch error. See code below:
If IsNull(DLookup("[CheckedOutTo]", "tbl_Transaction", "[CheckedInDate]" = Null And "AssetID = " & Forms!frm_NewTransaction!SN))
CheckedOutTo is Short Text, CheckedInDate is a date, and AssetID is a number. I'm not sure what I'm doing wrong or if there's an error in my syntax somewhere. Thanks in advance for the help.
Upvotes: 0
Views: 275
Reputation: 888
I think you need to do it this way:
If IsNull(DLookup("CheckedOutTo", "tbl_Transaction", "CheckedInDate is Null and AssetID = " & Forms!frm_NewTransaction!SN)) Then ...
Upvotes: 0
Reputation: 16015
You'll need to include the criteria values as part of the string supplied to DLookup
, i.e.:
If IsNull(DLookup("CheckedOutTo", "tbl_Transaction", "CheckedInDate is null and AssetID = Forms!frm_NewTransaction!SN"))
Upvotes: 1