Results 1 to 2 of 2
  1. #1
    asrivas1 is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2011
    Posts
    1

    How to populate previous record with next record value

    I have to populate enddate for previous record with Start date of new record. For example,
    If old record record#1, StartTime=9:00Am
    New Record record#2, StartTime =10am
    Then I need to update record #1 with end time =10am, I tried this code but it gives me error, please help
    Dim db As DAO.Database
    Dim rs As DAO.Recordset
    Dim tm As Variant
    Set db = CurrentDb
    Set rs = db.OpenRecordset("qryDailyTimetrackingMaxct")
    rs.MoveLast
    tm = rs!Time
    rs.MovePrevious


    rs![EndTime] = tm
    rs.Update

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    See http://allenbrowne.com/subquery-01.html

    There is a section on Get the value in another Record


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

Similar Threads

  1. Replies: 8
    Last Post: 07-06-2013, 05:13 PM
  2. Populate field from field on previous record
    By randolphoralph in forum Forms
    Replies: 7
    Last Post: 03-04-2011, 11:28 AM
  3. SQL Subquery on Previous Record
    By GoVols02 in forum Queries
    Replies: 1
    Last Post: 01-05-2010, 02:40 PM
  4. Populate date from previous record
    By Lianes in forum Access
    Replies: 3
    Last Post: 09-19-2009, 03:42 PM
  5. using value from previous record
    By dollars in forum Queries
    Replies: 0
    Last Post: 12-10-2008, 03:30 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