Results 1 to 3 of 3
  1. #1
    catfromtex is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Posts
    2

    Need Data from Previous Record to appear in Current Record Field

    I am a very beginner Access user setting up a form to track gallons of gas pumped from one location to various vehicles. On this form, I am trying to get the data from a previous record’s field (TOTALIZER) to appear in a current record’s field (Proof Gal).


    The TOTALIZER number is from a table called Fuel Log_El Rio. The name of the form is also Fuel Log_El Rio.
    The code I have written for my control source for the Proof Gal is the following:

    =DLookUp("TOTALIZER","Fuel Log_El Rio","[ID]=Forms![Fuel Log_El Rio]![ID]-1")

    It is returning a flickering (flashing?) Error message. Could anyone tell me what part of this I have wrong?

    Thanks for your help.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Do not enclose variables in quote marks. Concatenate variables. Reference to form control is a variable. Is this expression in a textbox on [Fuel Log_El Rio] form?

    =DLookUp("TOTALIZER", "Fuel Log_El Rio", "[ID]=" & [ID]-1)

    Is the ID an autonumber field? Beware depending on autonumber being sequential, there can be gaps. Here is one query method to get value from another record http://allenbrowne.com/subquery-01.html#AnotherRecord
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    catfromtex is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Mar 2014
    Posts
    2
    It worked! Thanks so much.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 07-19-2013, 03:42 PM
  2. Replies: 1
    Last Post: 02-16-2013, 09:25 AM
  3. Replies: 4
    Last Post: 09-09-2011, 10:00 PM
  4. Replies: 1
    Last Post: 07-25-2011, 09:41 AM
  5. Add data from previous record if blank
    By mbc321 in forum Queries
    Replies: 1
    Last Post: 08-08-2009, 05:15 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums