Results 1 to 7 of 7
  1. #1
    batowl is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    86

    Copy Records From Previous RecordInto New Record


    Hi All,

    I have been given an old, poorly constructed database and asked to make some modifications to it for some colleagues. Long story short, I need to find a way to allow the users to press a button on a form and have a subset of fields on the new record filled with the identical entries as the fields in the previous record. Could someone please guide me on how to do that? Thank you.

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Where are the records, are the in the main form or in a subform? And most importantly does the table you're access have a primary key, so that when you're in your subform you can reference it by looking the data based on that PK, finally would this only be used when creating new records or could it be used for updating existing records as well? What you're asking for is fairly complex if you're using a bound form, but pretty easy if you're using an unbound form as well so that would make a difference as to how you would approach this.

  3. #3
    batowl is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    86
    For this particular problem, there is only one form that is based off of one table (no subforms). There is no primary key for this table. The table is related to other tables in the db (which are not on the form) but referential integrity is not enforced among any of these tables.

    And the users would only use this button when performing data entry on new records.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    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.

  5. #5
    batowl is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    86
    Thanks for the tip, but that is not working for me. I did find a solution for starting a new record with data from the current record and that could work for me if I can find a way to carry over data for more than one field. Any suggestions for how to add multiple fields to this code so that when Command 30 is pressed, a new record is created with fields carried over from more fields than just [Beginning Date]?

    Private Sub Command30_Click()
    With Me.RecordsetClone
    .AddNew
    ![Beginning Date] = Me.[Beginning Date]
    .Update
    Me.Bookmark = .LastModified
    End With
    End Sub

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    You could just do the same thing as you have for the one, all sequentially in the same procedure.

    Other methods, review:

    http://allenbrowne.com/ser-24.html
    http://allenbrowne.com/ser-24a.html
    https://www.accessforums.net/forms/c...elp-28316.html
    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.

  7. #7
    batowl is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Dec 2010
    Posts
    86
    Ugh, there was a spelling difference between the form and the table, which made the code incorrect. Now it works. Solved.

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. Replies: 22
    Last Post: 06-12-2012, 10:02 PM
  3. Replies: 3
    Last Post: 11-23-2011, 12:25 AM
  4. Replies: 1
    Last Post: 07-25-2011, 09:41 AM
  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