Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Not evaluating IIF correctly

Status
Not open for further replies.

loydlr

Technical User
Mar 4, 2002
34
RU
I can't get the following to evaluate correctly

varTI5 = Nz(DLookup("TimeIn", "tblTimeCard", "Employee = '" & Me.Combo6 & "' AND DateIn = #" & varThuDate & "#"))

Me.txtTI5 = IIf(IsNull(varTI5), "", Format(varTI5, "short time") & " " & Format(varThuDate, "mm/dd/yy"))

Whether varTI5 is null or not it returns varThuDate. Would someone tell me what I'm doing wrong? Thanks...
 
As you use Nz, varTI5 is NEITHER null ...
Dim varTI5
varTI5 = DLookup("TimeIn", "tblTimeCard", "Employee = '" & Me.Combo6 & "' AND DateIn = #" & varThuDate & "#")
If Trim(varTI5 & "") = "" Then
Me.txtTI5 = ""
Else
Me.txtTI5 = Format(varTI5, "short time") & " " & Format(varThuDate, "mm/dd/yy")
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I've probably looked at a hundred of your posts to help sort out problems. As always, you have the answers. Thanks PHV...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top