Clear the subform

L

.Len B

I have a form whose job is to collect data in a subform in the
top half and display the past entries (uneditable) in the bottom
half. The RecordSource of the parent form (a query) has a 1-many
relationship with the RecordSource of the subform (a table). The
data in the parent is not intended to be edited. It is there to
provide a context for the subform data.

On the subform is a command button to save the data to the subform's
underlying table. This works fine but I also need it to clear the
subform to allow another entry.

I also want to update the list of past entries displayed in the
bottom half. I figure a Requery will update the display since the
fresh data is now in the table.

What is the best method of clearing/resetting the now-saved subform?
 
J

Jeanette Cunningham

If the subform has allow additions set to no, then change it to yes.
To go to a new record,
DoCmd.GoToRecord , , acNewRec


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
L

.Len B

Thanks Jeanette,
All good but ...

acNewRec clears the subform just fine but it sends the parent
form to the first record of the recordset. How do I prevent
that? Or do I just send it back?

--
Len
______________________________________________________
remove nothing for valid email address.
| If the subform has allow additions set to no, then change it to yes.
| To go to a new record,
| DoCmd.GoToRecord , , acNewRec
|
|
| Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
|
| | >I have a form whose job is to collect data in a subform in the
| > top half and display the past entries (uneditable) in the bottom
| > half. The RecordSource of the parent form (a query) has a 1-many
| > relationship with the RecordSource of the subform (a table). The
| > data in the parent is not intended to be edited. It is there to
| > provide a context for the subform data.
| >
| > On the subform is a command button to save the data to the subform's
| > underlying table. This works fine but I also need it to clear the
| > subform to allow another entry.
| >
| > I also want to update the list of past entries displayed in the
| > bottom half. I figure a Requery will update the display since the
| > fresh data is now in the table.
| >
| > What is the best method of clearing/resetting the now-saved subform?
| >
| > --
| > Len
| > ______________________________________________________
| > remove nothing for valid email address.
| >
| >
|
|
 
J

Jeanette Cunningham

If you put the acNewRec code on the subform, it shouldn't do anything to the
parent form.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

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