Pre-fill controls in subsequent records of continuous form

R

rheath

In a form (actually subform - but I don't think that makes a difference) in
which multiple records all have mostly the same control information (except
one control-StudentName) I would like all those other fields on the form to
pre-fill with the previous record info. Now, they are all blank and have to
be entered again. I thought about making a subform with just the name field.
But isn't there an easier way?
 
A

Allen Browne

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

Copy the code into your database, and follow the steps to set it up. The
code copies all fields down, but is clever enough not to try to duplicate
the autonumber or copy to calculated fields and controls, or unbound
controls. You can also specify particular fields you don't want copied in
the "exception list."
 
R

rheath

I tried this, but got a compile error on the line:
Dim rs As DAO.Recordset 'Clone of form
I don't understand enough VB to know how to fix this.
Can you help me further?
I do appreciate your help.
THis is for a continuous form in dataentry Yes so there is no 'first
record'. If it is the first time through, nothing should be preloaded. If
this were Cobol I'd know what to do (tells you how old I am....) Wish I knew
more VB but I'm a math faculty now and only get to dabble in this once in a
while.
Ruth
 
R

rheath

I did eventually figure out how to recompile with the missing DAO library.
I tried to not carryover 3 of the fields- an ID field and the 2 names
associated with it the came from a combo box.
But when I tested it, the first field is a combo box of a
CourseID/Coursename and it gave me the error:
Can not carry values over. Form , formname> has no records.
Can you help again?
 
R

rheath

There are records on this form whose controls are bound.

Where does it expect to get the info from, if not the first record on the
form?

So, is there no way to fill a 2nd, 3rd, 4th, etc record (one at a time, as
you need them) with info in first record? I'm not sure why you'd ever want
to

I did try the first method of the 2 you suggested which directed me to
another MVP's page who suggested setting Me.DefaultValue with
Me.ControlValue. This did set the default and the second record was
pre-filled with that default, but there was no way to change that. It
wouldn't let me alter the control value in the form (just in case some
fields/controls need to be altered from the usual prefilled value).

Any help would be appreciated.
Thanks,
Ruth Heath
 
A

Allen Browne

Sorry, Ruth: I'm down with the 'flu at present, not able to think straight.

Perhaps someone else can make a suggestion.
 
Top