Copy contents of one record to another

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

I have a form into which a lot of repetitive data needs to
be entered. Often times, the difference between 3 or 4
records is only the sample ID number. I can set up a
macro to copy the previous record, realizing that I need
to edit the sample ID inorder to save it. However, as
soon as I move the cursor to that field, I get an error
message saying I need to change the data in that field,
which is what I'm trying to do but can't accomplish.

Anybody have any ideas? It appears that the record needs
to be edited before Access saves the copy but I'm not
certain how to do this...

Thanks,
Peter
 
I have a form into which a lot of repetitive data needs to
be entered. Often times, the difference between 3 or 4
records is only the sample ID number. I can set up a
macro to copy the previous record, realizing that I need
to edit the sample ID inorder to save it.

A better approach is to set the Default property of each field which
might be duplicated in the AfterUpdate event of the form. That way
when you move to a new record, the previous record's values appear as
the default in every field for which you've done this.

It's best to do this in VBA code, not a macro: something like (using
your own control names of course):

Private Sub Form_AfterUpdate()
Const Quote As String = """"
Me!txtX.Default = Quote & Me!txtX & Quote
Me!txtY.Default = Quote & Me!txtY & Quote
<etc>
End Sub
 
Unfortunately, while the repetitive records are not rare,
they don't occur frequently enough where I would want to
use default values. The user will be doing a good bit of
deleting...

I'd suggest, then, running a one-record Append query appending only
the fields that you want to dup. Could you post the steps of your
macro?
 
Back
Top