Repeat fields from last record

A

Ardus Petus

Access 2003

I have a form with many fields most of which are based on a table.
My client would like these fields to be defaulted from the last entered
record.
Should I use Defaultvalue property for each field? If yes, how to get last
record without disturbing current (new) record ?

TIA
 
K

Klatuu

You can set the Default Value property of each control you want to carry over
the value for by using the Form Before Update event. You make the default
value the current value:

With Me
.txtSomeControl.DefaultValue = .txtSomeControl
.txtAnotherControl.DefaultValue = .txtAnotherControl
etc....
End With
 
A

Allen Browne

See:
Assign default values from the last record
at:
http://allenbrowne.com/ser-24.html

The article explains how to use the form's BeforeInsert event procedure to
populate the fields of the current record with the values from the last one.
The code recognises the autonumber and any calculated controls, so doesn't
try to assign them. You can also specify other controls that should not be
copied over.

If you have only one or two fields you want to duplicate, you could use the
DefaultValue of those controls, as explained here:
Carry current value of a control to new records
at:
http://www.mvps.org/access/forms/frm0012.htm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top