Dlookup works on Form but not on Report

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dlookup works when viewed one record at a time on the Form. I create a
Report based on the retrieved data from the form with the dlookup information
repeated for each field (same as in the Form). The data is correct on the
first line but repeats for all lines. Example Hours=32, Labor=30.57, is the
same for all retrieved records. The Dlookup does not change as the records
change.

Hope that is not confusing?
 
The Dlookup Command in the report looks like this:
=DLookUp("Sum([UnitCost])","TransactionsONE","[ParentID] = [WorkOrderID]")

Same as on the Form.
 
Unbound fields on a continuous form will all show the same value since there
is only a single instance of the control properties active at one time. The
unbound field will reflect the value appropriate for the current row. So,
if you click down the column in the form, you will probably see the value of
the unbound field change to reflect the new current record.

The solution is to base the form on a query that joins to the lookup table.
That way, you will have the lookup field available in the form's
RecordSource so you can bind a control to it. It will then show the correct
value for each row. Be careful when you use this technique. It is best to
set the locked property of the "lookup" field to Yes. This will prevent
accidental changes to the lookup table.
 
Back
Top