Duplicate a record from a form, then go to that new record

  • Thread starter Thread starter Nicole
  • Start date Start date
N

Nicole

I want to duplicate a record, clear out some of the
fields, then go to that record. I can duplicate the
record and clear out some of the fields, no problem, but I
am having trouble going to that new record that was
created. Any suggestions? Thanks in advance!
 
I don't understand. After you duplicate it and clear out the fields, aren't
you already there? You'll have to explain further. (Using actual form,
table, field, etc names if possible).
 
I have a form that the user doesnt want to have to type
the project number or the date again. So I was going to
copy the record, clear out the feilds that will be
different then go to that new record. However, using the
code below the record doesnt update until I leave it and
come back to the newly duplicated record.

DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 2, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 5, ,
acMenuVer70 'Paste Append

Me.Category = " "
Me.UnitAmount = 1
Me.OtherInfo = " "
Me.Notes = " "
 
Thanks. That helps.

Instead of using the dot (.) try the bang (!). Like this:

Me!Category = " "
Me!UnitAmount = 1
Me!OtherInfo = " "
Me!Notes = " "

This should show the cleared fields, but still leave it unsaved. If you
want the record saved, add this:

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

to the bottom.
 
That all works, Thanks, however, how do I get back to that
record that was just created minus the items I cleared
out. I can see the record duplicated, but it still has
the fields until I leave that record and come back.
 
I don't know if this is what you want but "Cntl+" will
dulpicate the value in the same field as the prevous record.

Jim
 
OK, try setting the focus to one of the cleared category fields, like this:
Me.Category = " "
Me.UnitAmount = 1
Me.OtherInfo = " "
Me.Notes = " "
Me.Category.SetFocus

You shouldn't have to move to another record and return.
 
Back
Top