Results 1 to 4 of 4
  1. #1
    New Lounger
    Join Date
    Mar 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    copying previous records (Access XP)

    Hi all, new here with a (hopefully) easy question. I have a series of related tables updated through a form with subforms. When a new entry is added to the "many" table, I would like the previous records' information to autofill into the new record. For instance, the main table has employee information (name, address, etc.), and one related table has pay info, dept, status, etc. Let's say an employee's pay changes....they only need to update the pay information, with the remainder of the fields remaining the same as the previous record; however, they do not wish to re-enter all the other information. They want to keep track of the employees' historical data. I am somewhat comfortable with Access, but the clearer the answer, the better as I am a little intimidated!! Thanks in advance!!

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: copying previous records (Access XP)

    Hi Cadzilla,

    Welcome to the Lounge!

    One possibility is to copy and paste a record:
    - Select the entire record by clicking the record selector (the gray bar to the left of the record.)
    - Select Edit | Copy.
    - Select Edit | Paste Append.
    - Change the value(s) that need to be different.

    If you want to copy fields selectively to the new record, you need to write a bit of VBA program code. MSKB article ACC2000: Fill Record with Data from Previous Record Automatically provides complete instructions (you can copy the code from it); this article also contains a link to download a demo database with a working example. Post back if you need further assistance.

  3. #3
    New Lounger
    Join Date
    Mar 2004
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: copying previous records (Access XP)

    Hi Hans...thanks for the welcome! Thanks for the microsoft link...never thought of searching there. What I fear is that when I add a new record, it will automatically copy the record directly above it. However, the record I am adding may be somewhere in the middle of the table (picking out a specific employee). I guess I'll simply try it and see if it works. I have tried the "sendkeys" function before to sendkeys CTRL & ' to automatically copy previous record (did that on the OnCurrent). However, that only added the last record, not the one I was looking for. I'll keep playing with it and see if I am missing something obvious! thanks again!

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: copying previous records (Access XP)

    The code from the Knowledge Base article copies values from the last record. If you want to copy a specific record, you could create a command button to copy the "current" record to a new one, whatever the "current" record is. See for example <post#=47991>post 47991</post#>.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •