Adding new records to subforms

  • Thread starter Thread starter Jess
  • Start date Start date
J

Jess

I have a form (mainform) with one subform: subform1 (subform1Name,
subform1ContainerName). Subform1 has another subform: subform2 (subform2Name,
subform2ContainerName)

How can I add a new record to subform1 and subform2 if I am in another form,
formx?

Thanks
 
Jess said:
I have a form (mainform) with one subform: subform1 (subform1Name,
subform1ContainerName). Subform1 has another subform: subform2
(subform2Name, subform2ContainerName)

How can I add a new record to subform1 and subform2 if I am in
another form, formx?

In a copy of your database, try an experiment like:

With Forms!mainform.subform1.Form.Recordset
.AddNew
!thisfield = somevalue
!thatfield = anothervalue
. . .
.UpDate
End With

With Forms!mainform.subform1.Form.subform2.Form.Recordset
.AddNew
. . .
.UpDate
End With
 
You might(??) be able to do it using DoCmd.RunSQL to execute
a Append query, but it could take a lot of code to create
the query or maybe some other mechanism based on details
about the information you want in the new records.

Based on what what you posted, I believe the code om my
earlier reply is the easiest way to do what you asked.
 
Back
Top