By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,444 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

Saving and Altering Records

P: 13
Hi.

I am working on the following process, and I am stuck at the bold faced step:

Take an existing Record, displayed on my form.
alter it
save it as a new record

I have been playing around with the following codes

I don't know the syntax, but I would be after something along the lines of
DoCmd.Save as New Record, (Don't change this one) ??

Thanks in Advance.
Jun 12 '07 #1
Share this Question
Share on Google+
8 Replies


FishVal
Expert 2.5K+
P: 2,653
Hi.

I am working on the following process, and I am stuck at the bold faced step:

Take an existing Record, displayed on my form.
alter it
save it as a new record

I have been playing around with the following codes

I don't know the syntax, but I would be after something along the lines of
DoCmd.Save as New Record, (Don't change this one) ??

Thanks in Advance.
I can suggest the following.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Command4_Click()
  3.     With DoCmd
  4.         .RunCommand acCmdSelectRecord
  5.         .RunCommand acCmdCopy
  6.         .GoToRecord acActiveDataObject, , acNewRec
  7.         .RunCommand acCmdPaste
  8.     End With
  9. End Sub
  10.  
  11.  
Jun 12 '07 #2

P: 13
Thanks. That's getting there, that seems to
create the new record, however it updates the old record as well.
Any thoughts on that?
Jun 12 '07 #3

missinglinq
Expert 2.5K+
P: 3,532
In what way does the code FishVal posted update your original record?
Jun 12 '07 #4

FishVal
Expert 2.5K+
P: 2,653
Thanks. That's getting there, that seems to
create the new record, however it updates the old record as well.
Any thoughts on that?
I've tested this. It works fine at least with two controls on the form: one combo and one text.
Actually it performs old good Copy/Paste. Did you test it?
Jun 12 '07 #5

missinglinq
Expert 2.5K+
P: 3,532
I think I've figured out what going on! Blair's altering the original record, then running FishVal's code! That's why it updating the original! Blair, you need to run FishVal's code, then alter the new, just created record!

The only problem I see with your code, FishVal, is that I think it'll bomb if any of the controls hold a field that is a Primary Key, as it'll be creating a duplicate.
Jun 12 '07 #6

P: 13
I just tested it again.

I used the nav arrows to go back to an old record.I have a comments box on my form, and I changed the comment from "test 1" to "test 2". The new record
is generated with the comment "test 2", however the original form/record is changed such that the comment now reads "test 2" as well.

Thanks for thinking about this guys.
Jun 12 '07 #7

P: 13
yep, you figured it out while i was writing my response. cool.
Jun 12 '07 #8

missinglinq
Expert 2.5K+
P: 3,532
Glad you got it working!
Jun 12 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.