Add new record to Subform (Code needed)

  • Thread starter Thread starter sachapd
  • Start date Start date
S

sachapd

Main Form :frmProfileAdd

SubForm :sfrmProfileAdd

Linked via master/child =PatientID

There is button on the main that i would like to click and add a new record
to the subform while the record on the main form stays.
 
Main Form :frmProfileAdd

SubForm :sfrmProfileAdd

Linked via master/child =PatientID

There is button on the main that i would like to click and add a new record
to the subform while the record on the main form stays.

Why not just click into the subform and add a record? If you want the
button to fill in data on the subform, where should that data come
from?

You should be able to use code like:

Private Sub cmdAddSubformRecord_Click()
Me.sfrmProfileAdd.SetFocus
DoCmd.GoToRecord acForm, Forms!frmProfileAdd!sfrmProfileAdd.Form, _
acNewRecord
<set the value of some control if you wish>
End Sub

John W. Vinson[MVP]
 
Back
Top