Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Help with DLookUp

Discussion in 'Information Technology' started by Simon Harris, Jul 28, 2006.

  1. Simon Harris

    Simon Harris
    Expand Collapse

    Hi All,

    I have a form that is used to record gas/electric meter readings for a
    caravan park. I need to display the previous readings on the same form.

    I have a query called QRY_PreviousReadings that gets the previous readings
    as follows:
    SELECT TOP 1 TBL_Readings.idInvoice, TBL_Readings.Electric_Reading,
    TBL_Readings.Gas_Reading, TBL_Allocations.idAllocation
    FROM TBL_Parks INNER JOIN (((TBL_Customers INNER JOIN TBL_Allocations ON
    TBL_Customers.IDCustomer = TBL_Allocations.CustomerID) LEFT JOIN
    TBL_Readings ON TBL_Allocations.idAllocation = TBL_Readings.AllocationID)
    INNER JOIN TBL_Pitches ON TBL_Allocations.PitchID = TBL_Pitches.idPitch) ON
    TBL_Parks.idPark = TBL_Pitches.ParkID
    ORDER BY TBL_Readings.idInvoice DESC;

    Note that the query when run with a where clause matching the DLookup filter
    returns the expected values.

    I've then set the control source of my previous readings field to this:
    =DLookUp("[gas_reading]","QRY_PreviousReadings","[idAllocation] = " &
    Which returns nothing!

    I've also tried this:
    =DLookUp("[gas_reading]","QRY_PreviousReadings","[idAllocation] = " &
    Which returns #Name?

    Note that me.idAllocation refers to a form field which has the current
    IDallocation - This stays the same for the duration of the persons stay on
    the park.

    Any help will be much appreciated!

    Many Thanks,
  2. Loading...

    Similar Threads Forum Date
    Interfaith So Help Me O’ God, Yahweh, Allah, Vaheguru, Et. Al…… Interfaith Dialogues Oct 19, 2016
    Interracial And Interfaith Marriage, Help Needed To Confront/convince My Parents Love & Marriage Aug 16, 2016
    Khalsa Aid Sikh Charity Praised For Helping Stranded UK Travellers Sikh Organisations Jul 26, 2016
    Sikh News Sikh Charity Praised For Helping Stranded UK Travellers - NDTV Breaking News Jul 26, 2016
    HELP ME! Sikh Sikhi Sikhism Mar 19, 2016

Share This Page