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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DLookup with multiple criteria

Status
Not open for further replies.

florens

IS-IT--Management
Nov 13, 2002
50
NL
I really need some help here!
On a report I want to show the planned time for an activity.
But I want it to appear behind the customer for which the activity was done and the employee who did the activity.
I came up with the following DLookup expression but it just doesn't work and I've tried numerous ways but it just doesn't show (and I know that there are numerous records to be shown, so there is no Null value).

=DLookUp("[rap_planned_time].[calculated_time]";"[rap_planned_time]";"[rap_planned_time].[customer_id]=[customer_id] AND [rap_planned_time].[employee_id]=[employee_id] AND [rap_planned_time].[activity_id]=[activity_id]")

actually I want to include the BETWEEN criteria too but I've never done that in a DLookUp expression (actually I quite suck at Dlookup) so tell me if the "experiment" below is correct (or just a miserable failure...).

it should actually do the following (plus the above mentioned stuff)
[rap_planned_time].[activity_date] BETWEEN [Date1] AND [Date2]


=DLookUp("[rap_planned_time].[calculated_time]";"[rap_planned_time]";"[rap_planned_time].[activity_date] BETWEEN [Date1] AND [Date2] AND [rap_planned_time].[customer_id]=[customer_id] AND [rap_planned_time].[employee_id]=[employee_id] AND [rap_planned_time].[activity_id]=[activity_id]")

Background info:
The report is based on a query [rap_work] which gets the activities that have been done.
I cannot add the fields I need from [rap_planned_time] to [rap_work] because of numerous reasons but I really need that information so thence the DLookup expression.


I really need some help here so if anyone could tell me WHAT I'm doing wrong and what it should be I would be very gratefull.

Florens
 
Hi, this might help. The following looks up a date from 'tblrpts' where the date is greater and less than two text boxes on a form and a the cost code = the one on frmPQ
The syntax should be correct.

=DLookup(&quot;[date]&quot;,&quot;tblRpts&quot;,&quot;[date]>= [Forms]![frmPQ]![txtStart] and [Date] <= [Forms]![frmPQ]![txtEnd] and [tblRpts]![CostCode] = Forms![frmPQ]![cboCost]&quot;)

Hope that helps.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top