Append new record - duplicating previous record

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

Guest

Greetings...

I have a form that allows the user to status plant equipment.

Currently I have the form open and goto the last record in the DB.

Problem...
Any changes made to this record are immediately reflected in the DB before a
new record is created.

How do I open the form, and have a new record displayed which reflects the
previous records information? I don't want the user have to update every
item, as a lot of it doesn't change day-to-day.
 
It sounds like you want the new record to automatically copy all the fields
from the last record in the form, and offer them as defaults for the new
record?

If that's the idea, see:
Carry data over to new record
at:
http://allenbrowne.com/ser-24.html
What that code does is that as soon as the user starts typing into the new
record, it copies all the controls that can be copied. (I am actually
looking at an update to that code soon, a considerably more powerful
approach that allows you to specify exceptions (controls that should not get
the default.))

If you don't like that approach, another is to use the AfterInsert event
procedure of your form to loop through all the controls and set their
Default Value property to the same thing as the Value. DefaultValue is a
string, so this does need special handling for dates and numbers.
 
Okay, the link has been updated with a completely new routine that:
- avoids overwriting the entry that the user is making;
- avoids controls that cannot be set (unbound, bound to an expression, or
calculated query field, or autonumber, or ...);
- lets you specify exceptions (controls that should *not* have their value
carried over).
 

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

Back
Top