Subform and mainform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Puru pela
    New Member
    • Jan 2016
    • 7

    Subform and mainform

    I have a form on which I've nested one subform in datasheet view to enable me enter data in a one to many relationship tables. Now I've included a comman button on the main form, so that in an onclick event, should take the cursor to a new record on the subform. Any tip will be greatly appreciated
  • mbizup
    New Member
    • Jun 2015
    • 80

    #2
    You need to do two things in the VBA code behind the button:

    1. Set the focus on the subform (the same way you would set focus on any other control):

    Code:
    Me.SubformControlName.SetFocus
    2. Go to a new record:
    Code:
    Docmd.RunCommand acCmdRecordsGotoNew

    Comment

    • Puru pela
      New Member
      • Jan 2016
      • 7

      #3
      Great! Thanks a million, I got it.

      Comment

      Working...