Results 1 to 8 of 8
  1. #1
    alexandervj is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    145

    how to copy last entry data for new entry


    I've got an inventory database for our parts, and our parts usually come in lots. So could be 20 - 30 parts with roughly the same information that needs to be put in the database at a time with a few slight variations. Is there a way I can copy from the last entry certain fields or something so the fields that will have the same information will get copied from the last entry if a check box is checked or something like that? Thanks

    Actually this is what I'm looking for but functions with a checkbox with an if statement. ie if checkbox then copy values from last entry

    http://allenbrowne.com/ser-24.html
    Last edited by June7; 11-11-2013 at 03:41 PM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Why bother with the checkbox? Why does user need to choose? Just set the DefaultValue property. It's not engraved in stone, user can still change to whatever they want and it's one less click.

    Allen's code may be more elaborate than you need.

    In the BeforeUpdate event procedure for control:

    Me.controlname.DefaultValue = Me.controlname
    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.

  3. #3
    alexandervj is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    145
    I would rather have it update the data after a checkbox has been clicked or at least a button is pressed. Theres about 6 fields that need to be autofilled with data from the previous entry and it can get a little confusing for users exactly what data to enter if all the data is already filled all the time. I just want this to happen if it the part was manufactured in the same lot

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    The DefaultValue property must be set while on the record where the values were entered.

    Alternatively, use hidden textboxes on form (or global declared variables) to populate with the data and reference those entities when checkbox clicked or button clicked to simply populate fields of new record.
    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
    alexandervj is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    145
    thanks very much for your help. I'm pretty much a complete noob, how would i implement that code? Thanks again

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Which do you want, hidden boxes or global variables? I avoid global variables because during debugging they will be wiped out when code is interrupted.

    In the BeforeUpdate event of form, populate the hidden textboxes with values from the data entry controls:

    Me.textboxname1 = Me.controlname1
    ...

    Then in the button Click event, populate the fields of the current record, but maybe only if the field is null:

    If IsNull(Me.controlname1) Then Me.controlname1 = Me.textboxname1
    ...
    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
    alexandervj is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    145
    I don't seem to have a BeforeInsert or BeforeUpdate property in the events of my form :/
    Is this because I'm using a web database? Maybe I'm missing something....

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Could be, I am not very familiar with web databases. You do have Data Macros but I am not sure if can do what you want with them.
    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.

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

Similar Threads

  1. Data Entry
    By buckwheat in forum Access
    Replies: 3
    Last Post: 06-28-2013, 10:31 AM
  2. Replies: 2
    Last Post: 05-20-2013, 05:23 PM
  3. Replies: 3
    Last Post: 03-09-2013, 10:39 AM
  4. Replies: 6
    Last Post: 09-27-2012, 08:27 AM
  5. Data Entry
    By DBA-Meister in forum Forms
    Replies: 7
    Last Post: 09-08-2012, 10:03 PM

Tags for this Thread

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