Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Posts
    27

    Unanswered: Save a record as a new record.

    I'm looking for an easy "Save as" type function to use on a bound form. So instead of entering data in 14 fields for a new record, they can bring up an existing record, change a couple fields and save it as a new record, without changing the original record. I'm sure this has been a topic before, but I couldn't find it with a search.

    I realize that it is probably a better, safer practice to enter a new record from scratch but they want a shortcut.

  2. #2
    Join Date
    Jul 2006
    Posts
    108
    i dont exactly know how to do what your talking about but:

    here's an idea, you can always set the F1-12 buttons to do certain functions,

    in example say that have to enter todays date on every record the use. instead of keying it in the hit F1 and it auto-enters it for them,

    F2 is their name or similar stuff
    you could even create a function that opens a form or something to allow them to select 1 of 3 static options like this:

    user presses f3 and a new form opens up with 3 buttons (status buttons)
    button1: Ordered
    button2: in transit
    button3: Arrived

    then whichever button they hit auto-enters the data into their current field.

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    How "easy" it is depends on your point of view, I guess, but this works for me! You can either follow my lead by writing a "prompt" into each of the fields they need to fill on the new record, or they'll be blank. Whichever works for you! Maybe someone's got an easier way! I'm always ready to learn a new trick!

    Code:
    Private Sub CopyRecord_Click()
    
    'Copy current field values to variables
    MyFirstField = Me.FirstField
    MySecondField = Me.SecondField
    MyThirdField = Me.ThirdField
    
    'Go to a new record
    DoCmd.GoToRecord , , acNewRec
    
    'Prompt user to enter new Primary Key
    Me.PrimaryKeyField.Value = "Enter New Primary Key"
    
    'Plugs old values into new record
    Me.FirstField.Value = MyFirstField
    Me.SecondField.Value = MySecondField
    Me.ThirdField.Value = MyThirdField
    
    End Sub
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Mar 2004
    Location
    UK
    Posts
    82
    missingling's post looks good, i might give it a try,

    i do sometimes use the DLOOKUP function in vb code or in expressions on text boxes to achieve similar results.

    by the way, if you need to set a date field as the current date, or any other field to a preset value, then you might want to try using the DEFAULT VALUE property for the tables field in design view.

    hope it helps

  5. #5
    Join Date
    Aug 2006
    Posts
    27
    Quote Originally Posted by Missinglinq
    How "easy" it is depends on your point of view, I guess, but this works for me! You can either follow my lead by writing a "prompt" into each of the fields they need to fill on the new record, or they'll be blank. Whichever works for you! Maybe someone's got an easier way! I'm always ready to learn a new trick!

    Code:
    Private Sub CopyRecord_Click()
    
    'Copy current field values to variables
    MyFirstField = Me.FirstField
    MySecondField = Me.SecondField
    MyThirdField = Me.ThirdField
    
    'Go to a new record
    DoCmd.GoToRecord , , acNewRec
    
    'Prompt user to enter new Primary Key
    Me.PrimaryKeyField.Value = "Enter New Primary Key"
    
    'Plugs old values into new record
    Me.FirstField.Value = MyFirstField
    Me.SecondField.Value = MySecondField
    Me.ThirdField.Value = MyThirdField
    
    End Sub
    Thanks a lot. It seems to work fine. It seems like this should be easier to do, but I'm happy to have this code. Have a great weekend, Go Buckeyes!

Posting Permissions

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