Results 1 to 5 of 5
  1. #1
    Wabos42 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2016
    Posts
    2

    Default value

    When entering data into a table, I would like for some of the fields in the new/current record to default to the same value as entered in the previous record. Is there a function to do identify the previous record?



    Thanks

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    One way:

    http://access.mvps.org/access/forms/frm0012.htm

    It gets more complicated if you want the last record, whenever it may have been entered, as opposed to the current session of the form being opened.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Why not just store the primary key field of the prior record instead, then you can just look the data you want up instead of repeating it. This would also prevent errors where the prior record may get updated but the same updates are not made on the 'new' record.

  4. #4
    Wabos42 is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2016
    Posts
    2
    The primary key field (Entry ID) is auto generated so it is always 1 less than the current record but I am not sure how to use it in 'Expression Builder'.

  5. #5
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    if it's always the record prior to the current one you could fill it in the ON ENTER property of the field you could have code like

    [PrevRec] = dmax("[PrimaryKeyField]", "TableName")

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

Similar Threads

  1. Set a default on the fly
    By Thompyt in forum Programming
    Replies: 5
    Last Post: 03-25-2016, 11:41 AM
  2. Default Value
    By Njliven in forum Access
    Replies: 1
    Last Post: 10-10-2012, 12:48 PM
  3. Set default value
    By accessnewb in forum Programming
    Replies: 3
    Last Post: 08-17-2011, 06:24 PM
  4. Default value
    By Hatye in forum Access
    Replies: 1
    Last Post: 06-19-2011, 05:16 PM
  5. Default Forms
    By BigCat in forum Forms
    Replies: 10
    Last Post: 06-09-2011, 03:36 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