Adding data to a subform

  • Thread starter Thread starter RC-
  • Start date Start date
R

RC-

Hi all,
How can I add data to a subform using VBA? I know that I can manually
enter the data, but I want to be able to click a button and populate the
data automatically. I know how to capture the data that I want to send to
the subform, I just don't know how to populate the subform with the data.


Any help is greatly appreciated
RC-
 
On the onclick event of the button you can write this code

Me.SubFormName.setfocus
DoCmd.GoToRecord , , acNewRec
Me.SubFormName.form.Field1Name=Value1
Me.SubFormName.form.Field2Name=Value2
Me.SubFormName.form.Field3Name=Value3
Me.SubFormName.form.Field4Name=Value4
 
Excellent, thank you.
Ofer said:
On the onclick event of the button you can write this code

Me.SubFormName.setfocus
DoCmd.GoToRecord , , acNewRec
Me.SubFormName.form.Field1Name=Value1
Me.SubFormName.form.Field2Name=Value2
Me.SubFormName.form.Field3Name=Value3
Me.SubFormName.form.Field4Name=Value4
 

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

Back
Top