Results 1 to 5 of 5
  1. #1
    phineas629 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    47

    setting up a form for duplicating records

    I have a form with old records. I want to be able to duplicate records but I don't want to edit old records. I used the wizard to add a "duplicate record" button but it doesn't function because I set my data property sheet to NO for "allow edits".



    Basically, I want a form to copy records and add it to a table. However, the form is not for editing old records. Any ideas?


    Thanks in advance

  2. #2
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by phineas629 View Post
    I have a form with old records. I want to be able to duplicate records but I don't want to edit old records. I used the wizard to add a "duplicate record" button but it doesn't function because I set my data property sheet to NO for "allow edits".

    Basically, I want a form to copy records and add it to a table. However, the form is not for editing old records. Any ideas?


    Thanks in advance
    Are you saying that you want to be able to copy old records from a table and paste it to another table?

  3. #3
    phineas629 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    47
    I'm probably not being clear enough about my situation. For my tblCLAIM, I have 3 forms: one for adding a new claim, one to edit old claims, and one form to copy old claim to make a new claim.

    The reason I copy old claims to make new claims is that often times the charges stay the same everyday but the dates changed.


    i.e. There's a scheduled charge for Anthony which is 2 units a day for the whole year. I had to enter the same charge for everyday for the year.


    Doesn't sound like much until you're doing it for 50 people. Everyday I put in the same charges for each of my 50 clients but I just change the date. There's got to be an easy solution.


    Thanks again

  4. #4
    phineas629 is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    May 2011
    Posts
    47
    Basically, I want to automate my data since it repeats everyday for most of the whole year. I might have to do maybe 1 edit for each clients for the whole year.

  5. #5
    Toyman is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    233
    Quote Originally Posted by phineas629 View Post
    Basically, I want to automate my data since it repeats everyday for most of the whole year. I might have to do maybe 1 edit for each clients for the whole year.
    In your form containing the old records, put this code behind the button to duplicate the records.

    Dim Mysql as string
    Dim sVal1 as string
    Dim sVal2 as string 'create one of these for each field in your form

    'assign the value from the form field to the veriables

    sVal1 = Me.YourFirstFieldName
    sVal2 = Me.YourSecondFieldName 'etc

    'create a append sql based on the veriables above
    Mysql = "INSERT INTO YourTableName ( FirstFieldName, SecondFieldName)
    SELECT '" & sVal1 & "' AS sField1, '" & sVal2 & AS sField2"

    'run your append sql
    DoCmd.Setwarnings False 'turns off warning prompts
    Docmd.RunSQL Mysql 'run your append sql
    DoCmd.Setwarnings True 'turn the warning prompts back on

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

Similar Threads

  1. Replies: 3
    Last Post: 10-14-2011, 08:52 AM
  2. Setting default value for all records in form
    By robsworld78 in forum Forms
    Replies: 15
    Last Post: 08-14-2011, 12:48 AM
  3. Setting Reference Number for records
    By ankash in forum Programming
    Replies: 1
    Last Post: 07-12-2011, 06:12 AM
  4. duplicating records
    By kstyles in forum Queries
    Replies: 7
    Last Post: 12-31-2010, 02:31 PM
  5. Problem with "join" duplicating records
    By Zukster in forum Queries
    Replies: 0
    Last Post: 08-25-2009, 09:00 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