DLookup

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Help!!!

Can anyone tell me what is wrong with the last part of this DLookup? The
PackageDePalletizedTS is a Date field.

PkgIndDet = DLookup("[txtPkg]", "tblPallet", "[Package_ID] ='" & Me![txtPkg]
& "'" And "[Pallet_ID] ='" & Forms![frmInductPalletID]![txtPltID] & "'" And
"[PackageDePalletizedTS] <> '" & Null & "'")

Thanks!
 
Shawn said:
Help!!!

Can anyone tell me what is wrong with the last part of this DLookup?
The PackageDePalletizedTS is a Date field.

PkgIndDet = DLookup("[txtPkg]", "tblPallet", "[Package_ID] ='" &
Me![txtPkg] & "'" And "[Pallet_ID] ='" &
Forms![frmInductPalletID]![txtPltID] & "'" And
"[PackageDePalletizedTS] <> '" & Null & "'")

Thanks!

You cannot use = or <> to compare to Null. Use "Is Null" or "Is Not Null"
in Queries and Domain Aggregate fiunctions and the IsNull() function in VBA
Code.
 
Try this

PkgIndDet = DLookup("[txtPkg]", "tblPallet", "[Package_ID] ='" & Me![txtPkg]
& "' And [Pallet_ID] ='" & Forms![frmInductPalletID]![txtPltID] & "' And
[PackageDePalletizedTS] is not null")
 
Take out the single apostrophes surrounding NULL. They cause Access to
consider the value as a text value - literally does the field equal the
text spelled N U L L as opposed to the VALUE of Null. I marked the
problem with curley brakets {'}

"[PackageDePalletizedTS] <> {'}" & Null & "{'}")
 
Back
Top