Dlookup with TempVars

anishkgt

Registered User.
Local time
Today, 06:31
Joined
Nov 4, 2013
Messages
384
Hi All,

Was trying build security feature with Dlookup and tempvars. I've got a call log system where there is a check box if a followup is required. My idea is, if the [AttendedBy_FK] and the [Tempvars]![TempEmpID] are equal in then the Check box (chkFollowup) is enabled else it should be disabled.Thereby only the employee who logged the call can followup on it. So far my expression is as follows,

DLookUp("[LogID]",[tblLogOverview],"[AttendedBy_FK]='" & [TempVars]![EmpEmpID] & "'")


Unfortunately the above gives me a big error "The object doesn't contain the automation object 'tblLogOverview.' " I've attached a screeshot also.

Thanks in advance.
 

Attachments

  • Dlookup.jpg
    Dlookup.jpg
    48.3 KB · Views: 203
Code:
DLookUp("[LogID]", [B][COLOR="red"]"[/COLOR][/B][tblLogOverview][B][COLOR="Red"]"[/COLOR][/B], "[AttendedBy_FK]='" & [TempVars]![EmpEmpID] & "'")
 
Well that was the wrong expression, i was going after. i've managed amend the expression like this
If =DLookUp("[LogID]","tblLogOverview","[AttendedBy_FK]")=[TempVars]![TempEmpID] Then
Do something
Else Do something

I just can't get the dlookup to lookup the required data in the field. I've attached form, in which i need the Dlookup to lookup the LogID within this form from tblLogOverview and compare it with Attendedby_FK.
 

Attachments

  • Untitled.jpg
    Untitled.jpg
    42 KB · Views: 161
Last edited:
ok finally got it, expression is

=DLookUp("[AttendedBy_FK]","tblLogOverview","[LogID]=" & [Forms]![frmCallDetail-Log]![LogID])=[TempVars]![TempEmpID]
 
Yes ! just a true false, That expression is just part of my macro. I've added to the on load action of the form. It goes inside an if else statement. The expression will check if the AttendedBy_FK is equal to the TempEmpID. If equal the followup check box will be enabled and else not enabled. There will be no null values either. Thanks for the advise tho :)
 

Users who are viewing this thread

Back
Top Bottom