Add new record to Subform (Code needed)

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.
 
J

John Vinson

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]
 

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