Results 1 to 3 of 3
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Manchester, Gtr Manchester, England
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Add record to bound subform (2000/XP)

    I have a bound subform and want to create a new record using data from a control on the parent form.

    I just can't think what to do. I can't a add row to the underlying recordset can I?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Add record to bound subform (2000/XP)

    You could use code like this, for example in the On Click event of a command button on the main form:

    Me!sbfTest.SetFocus
    RunCommand acCmdRecordsGoToNew
    Me!sbfTest!txtSub = Me!txtMain

    Where:
    - sbfTest is the name of the subform as a control on the main form
    - txtMain is a text box on the main form
    - txtSub is a text box on the subform

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Manchester, Gtr Manchester, England
    Posts
    299
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Add record to bound subform (2000/XP)

    Thanks

    I seem to be getting an error if I try to add a record for the first time (as I'm already on a new record I guess)

    'RunCommand acCmdRecordsGoToNew not available'


    Edit.

    I had

    If Me!fsubDocument_KeywordsCont.NewRecord Then

    instead of

    If Me!fsubDocument_KeywordsCont.Form.NewRecord Then

    Works okay now

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •