Results 1 to 7 of 7
  1. #1
    sonoamore is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    18

    Static and Current Copies

    Hello everyone,



    I have a entry system using a single entry form, and a single table. Let's call them ENTRY and INITIAL. The fields can be simply referred to as A, B, C, etc. What I'm trying to do is this:

    1. Data entered on ENTRY form, populating table INITIAL.
    2. When the submit button is pressed, it closes the form and copies the entry into a 3rd table I would like to add called CURRENT.
    3. Users can only edit the information in the table CURRENT through a seperate form.

    The idea is that the initial form would always be preserved in the INITIAL table, and through the use of a seperate form only be allowed to edit the copied data in CURRENT. That was there is always a comparison.

    What I'm having trouble with is the coding to cause the submit button to write a copy of the data in the CURRENT table. It's probably simple and I'm overthinking it, but it's giving me trouble.

    Any help would be greatly appreciated!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Possible code:

    DoCmd.RunCommand acCmdSaveRecord
    CurrentDb.Execute "INSERT INTO CURRENT(A, B, C) SELECT A, B, C FROM INITIAL WHERE ID=" & Me.ID

    If you want to keep an audit log of all edits to records, review: http://allenbrowne.com/AppAudit.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.

  3. #3
    sonoamore is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    18
    Quote Originally Posted by June7 View Post
    Possible code:

    DoCmd.RunCommand acCmdSaveRecord
    CurrentDb.Execute "INSERT INTO CURRENT(A, B, C) SELECT A, B, C FROM INITIAL WHERE ID=" & Me.ID

    If you want to keep an audit log of all edits to records, review: http://allenbrowne.com/AppAudit.html
    That actually worked really, really well with one small problem:

    There's so many fields I need to copy that it's throwing a fit. :P

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    What is the nature of the 'fit' - error message, wrong results, nothing happens?
    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
    sonoamore is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    18
    Quote Originally Posted by June7 View Post
    What is the nature of the 'fit' - error message, wrong results, nothing happens?
    Sorry, should have been more specific.

    By FIT I mean the string is so long when all the fields are put into that code that it forces a wrap around to another line and stops compiling.

    There's about 90 fields, and the names are as short as they can be without going to , "1, 2, 3, etc"

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Really, I never knew that could be an issue.

    Can use line continuation character and concatenation.

    CurrentDb.Execute "INSERT INTO CURRENT(A, B, C) " & _
    "SELECT A, B, C FROM INITIAL WHERE ID=" & Me.ID

    Another option is if the tables have the same fields and the fields are in the same order in the design:

    CurrentDb.Execute "INSERT INTO Current SELECT * FROM Initial WHERE ID=" & Me.ID
    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
    sonoamore is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2012
    Posts
    18
    Quote Originally Posted by June7 View Post
    Really, I never knew that could be an issue.

    Can use line continuation character and concatenation.

    CurrentDb.Execute "INSERT INTO CURRENT(A, B, C) " & _
    "SELECT A, B, C FROM INITIAL WHERE ID=" & Me.ID

    Another option is if the tables have the same fields and the fields are in the same order in the design:

    CurrentDb.Execute "INSERT INTO Current SELECT * FROM Initial WHERE ID=" & Me.ID
    Worked perfectly. THANKS!

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

Similar Threads

  1. Static value in field
    By crewjones in forum Access
    Replies: 2
    Last Post: 07-18-2013, 05:18 PM
  2. Control within Static Text
    By mcrow in forum Reports
    Replies: 3
    Last Post: 06-07-2012, 10:41 AM
  3. Replies: 10
    Last Post: 08-18-2011, 04:27 PM
  4. Are reports static?
    By Buakaw in forum Reports
    Replies: 3
    Last Post: 03-22-2011, 10:24 AM
  5. Static Array Issue
    By Tinarad in forum Programming
    Replies: 1
    Last Post: 03-01-2011, 01:14 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