Results 1 to 8 of 8
  1. #1
    randolphoralph is offline Advanced Beginner
    Windows XP Access 2002
    Join Date
    Dec 2008
    Posts
    58

    Populate field from field on previous record

    I have a form that allows users to add new records only when they click on a button on the form.



    I am trying to get a field named Unique ID to populate with the same information from the previous record that the user entered only when the user pushes the button.

    I am not sure where to begin to get this to work.

  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,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    randolphoralph is offline Advanced Beginner
    Windows XP Access 2002
    Join Date
    Dec 2008
    Posts
    58
    Thanks pbaldy!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    DNRTech is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    32
    Hi, pbaldy.

    I was wondering how I could adapt this solution for the previous entered value to be the default value for each new record with using a control button.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I don't understand what you want to do differently. More common than putting this behind a button is probably putting it in the after update event of the control.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    DNRTech is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    32
    oh I'm sorry,typo. I meant without a control button. I'll try to put it behind the after update event.

  8. #8
    DNRTech is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jan 2011
    Posts
    32
    I still had trouble using the code in the above link in an after_update event for whatever reason, maybe its a 2007 issue.

    I did find another method. To use the previous entry as the default value for a record one can add this code to the default value property of the control. Not sure if this will work for combo boxes, but it seems to work fine for text fields.
    Code:
    =DLast("FieldName","TableName")

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

Similar Threads

  1. Replies: 2
    Last Post: 05-05-2010, 02:52 PM
  2. IIF statement to populate field
    By GriffyNJ in forum Queries
    Replies: 0
    Last Post: 10-13-2009, 10:07 AM
  3. populate the same named field in two subforms??
    By jhjarvie in forum Programming
    Replies: 1
    Last Post: 09-25-2009, 04:34 AM
  4. Populate date from previous record
    By Lianes in forum Access
    Replies: 3
    Last Post: 09-19-2009, 03:42 PM
  5. Replies: 1
    Last Post: 02-26-2009, 11:31 AM

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