Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2005
    Posts
    13

    Copy a record


    I would like to call a record using a query to fill a form.

    After displaying the data on a form I will change one field and save the record back to the table as a new record.

    I have tried several methods and none seems to work.

    If I call up the record in edit mode and then save it then I lose the original record.

    Here is my question. Does anyone have some code that will perform this operation or direct me to a resource that will help.

    Thanks for any assistance.

    B Hall

  2. #2
    Join Date
    Dec 2005
    Location
    Wilmington, DE - USA
    Posts
    275
    Ideally you would probably want to use an unbound form. I cam up with this pretty quickly to use on a bound form, but it is very inelegant and I would hold out for a better solution if you have the time.

    Code:
    Private Sub Form_BeforeUpdate(Cancel As Integer)
    
        With DoCmd
            .SetWarnings False
            .RunSQL "INSERT INTO MyTable (text1, text2, num1, num2) SELECT '" & Me![text1] & _
                "' AS Expr1, '" & Me![text2] & "' AS Expr2, " & Me![num1] & " AS Expr3, " & _
                Me![num2] & " AS Expr4"
            .SetWarnings True
        End With
        Me.Undo
        Cancel = True
        
    End Sub

  3. #3
    Join Date
    Oct 2005
    Posts
    13

    copy record

    Patrick,

    Thanks, I will give it a try.

    I found an alternative that is also inelegant.

    The concept I was working on is to allow my sales department to have the ability to call up a standard quote, review it, edit it if needed and assign a new quote number.

    I created a table that has only the standard quotes. I open that table , retrieve the record required , edit as required, assign a new quote number.

    When the salesman clicks on the finished button the record is saved back to its table, and an append query adds the record to the other table that is used for history and printing and emailing of the quote to a customer.

    It seems to be working okay but I prefer to do it similar to what you propose.

    Bob

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

Similar Threads

  1. Replies: 2
    Last Post: 06-06-2011, 04:18 PM
  2. Replies: 0
    Last Post: 11-10-2008, 12:32 PM
  3. How to move copy queries and reports.
    By Fred C in forum Access
    Replies: 1
    Last Post: 11-08-2008, 10:24 AM
  4. Replies: 0
    Last Post: 09-21-2008, 11:28 AM
  5. Making a backup copy of table or database
    By wasim_sono in forum Access
    Replies: 0
    Last Post: 03-09-2006, 05:44 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