Results 1 to 4 of 4
  1. #1
    hcuk is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    22

    Using DLookup to grab data from a previous record


    Not sure if i've used dlookup correctly but I am trying to grab a field from a previous record and put it in the current record, when I put the following code into the previous cost control source, it tells me there is a "Circular Reference" error. Please advise.

    =DLookUp([Total Cost],[Field - Report Section],[Previous Cost]=[Forms]![Field - Report Section subform]![Total Cost]-1)

    Thanks in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you would need a record number.
    where [id]= [id]-1

  3. #3
    hcuk is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    22
    Quote Originally Posted by ranman256 View Post
    you would need a record number.
    where [id]= [id]-1
    So it would look like this?

    =DLookUp([Total Cost],[Field - Report Section],[ID] = [id] -1)

    Here are some screen shots to better clarify my problem.
    Click image for larger version. 

Name:	Access Form.png 
Views:	18 
Size:	20.1 KB 
ID:	18714

    I want the previous cost to show the value of the total cost from the previous record. Then the total cost = daily cost + previous cost.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Control and field used in expression have same name which causes circular reference error. Name the textbox something like tbxTotal.

    Domain aggregate arguments must be included within quote marks. Review http://rogersaccessblog.blogspot.com...mystified.html

    Also might be of interest http://access.mvps.org/access/forms/frm0012.htm
    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.

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

Similar Threads

  1. Replies: 2
    Last Post: 03-05-2014, 05:37 PM
  2. Replies: 5
    Last Post: 07-19-2013, 03:42 PM
  3. Replies: 4
    Last Post: 09-09-2011, 10:00 PM
  4. Replies: 1
    Last Post: 07-25-2011, 09:41 AM
  5. Replies: 2
    Last Post: 11-04-2009, 09:45 PM

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