Create new record with values from the last record

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In my form I need a button witch creates a new record with some of the values
from the last record (not all of them).

Is this possible?

In another database I've used (SprintDB for Pocket PC) I could use a
function called "SetControl" in the OnClick event, and set the values of the
specified controls. I can't find this function in Access.
 
So you want to create a record that duplicates some of the existing fields,
and allow the user to fill in the others?

Here's a couple of approaches.

This one shows how to create the new record, specifying only the fields you
want duplicated. It then displays it on screen so the user can edit it as
needed. Details in:
Duplicate the record in form and subform
at:
http://allenbrowne.com/ser-57.html
(Just ignore the block about adding records in the related subform as well.)

This one copies the values from the *last* record as soon as you start
typing into the new record. It knows to avoid trying to duplicate the
AutoNumber and any calculated or unbound controls. You can also specify
which fields it should not duplicate. Details in:
Assign default values from the last record
at:
http://allenbrowne.com/ser-24.html
 
Perfect! Your first example is exactly what I need!

Adding records in the related subform was my "follow-up-question" and you
have already answered it! :)

Thank you!

Haukalid
 
Back
Top