I have this DLookup statement that has NULL's in it but I can't seem to nail
down the syntax. Any help apreciated.
Thanks
DS
Me.TxtJobID = DLookup("LogJobID", "tblTimeLogs", "LogEmpID= " &
Forms!frmSignOut!TxtID & " And LogTimeOut = Null And LogDateOut = Null)
A Field can't = Null but you can find out if it IsNull() or Is Null.
Also you need to enclose the where clause argument in Quotes. You left
the last one off.
Using [FieldName] Is Null syntax:
Me.TxtJobID = DLookup("LogJobID", "tblTimeLogs", "LogEmpID= " &
Forms!frmSignOut!TxtID & " And LogTimeOut Is Null And LogDateOut Is
Null")
Or using the IsNull(FieldName) syntax:
Me.TxtJobID = DLookup("LogJobID", "tblTimeLogs", "LogEmpID= " &
Forms!frmSignOut!TxtID & " And IsNull(LogTimeOut) And
IsNull(LogDateOut)")
Note: If this code is on the form named frmSignOut you can substitute
the Me keyword for forms!frmSignOut.
"LogEmpID= " & Me!TxtID & " And IsNull(LogTimeOut) And
IsNull(LogDateOut)")