DLookUp gets me every time

atrium

Registered User.
Local time
Today, 17:23
Joined
May 13, 2014
Messages
348
I want to check the AppStart table for a match on ApplicationId and one of the fields = 'Complete' This is what I have

If (DLookup("ApplicationId", "AppStart", "[ApplicationId] = " & _
Me.ApplicationIdFld & " AND [StartStatus] = '" & "Complete" & "'") = True) _
Then
Me.StartTickFld.Visible = True
End If

I know that there is a row that matches my request but It never goes down the true path
Any Help would be appreciated
 
The logic does not seem to make sense. You are returning an application ID and comparing it to True?

Should it be?

NZ(DLookup("StartStatus", "AppStart", "[ApplicationId] = " & Me.ApplicationIdFld )) = "Complete" Then
 
Thanks MajP for the super quick turn around. I never thought of using it like that.
Thanks heaps.
 
One suggestion for doing Dlookup with a criteria. Save the criteria as a variable so that you can debug it, especially if complex
Code:
dim strWhere as string
strWhere = "[ApplicationId] = " & Me.ApplicationIdFld & " AND [StartStatus] = 'Complete'"
debug.print strWhere
'does it look correct? If so try dlookup
...DLookup("ApplicationId", "AppStart",strWhere)
 

Users who are viewing this thread

Back
Top Bottom