Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    May 2003
    Location
    cork, Ireland, Republic of
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    saving fields from a subform (access 2000 vba)

    Hi I wonder if anyone can help me with this - any help greatly appreciated - have tried loads of different things and nothing works........
    (using Access db)
    I have a subform B (with 4 txtfields) on a form A. On filling in a couple of textboxes in A, subsequent textfields are filled using a sql statement. Then I get the autonumber ID back from the table where values in form A are stored. Then onto the (continuous) subform B which could be 1 or many entries(records). What I need to do is save the ID into the table![id] behind subform B. The problem is that only the first record in the subform has the ID saved into the table. Subsequent records have 0 instead of the ID and this obviously won't do. Any ideas?
    tia
    Sheila

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

    Re: saving fields from a subform (access 2000 vba)

    From your description, I would say that you need to link the subform to the main form by the ID field.

    Open FormA in design view.
    Then select the subform by clicking on it once (don't click a second time inside the subform, for that will select something on the subform).
    Activate the Data tab of the Properties window.
    Set Link Child Fields and Link Master Fields to ID (if you click the builder button in either of these - the three dots on the right - Access will probably propose this).

    If the main form and subform have been linked properly, the ID will be filled in automatically when you start entering a new record in the subform.

  3. #3
    Lounger
    Join Date
    May 2003
    Location
    cork, Ireland, Republic of
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: saving fields from a subform (access 2000 vba)

    Thanks again for taking the time to help me Hans

    I've tried doing what you suggested. However even tho the title bar of form B says "subform" I got the error "can't build a link between unbound forms". Any ideas?

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

    Re: saving fields from a subform (access 2000 vba)

    Sometimes you can't use the builder button, but you should still be able to fill in the Link Child Fields and Link Master Fields by hand. Make sure that you have a control (text box) on the main form that contains the ID. Enter the name of this control in Link Master Fields, and set Link Chield Fields to ID.

  5. #5
    Lounger
    Join Date
    May 2003
    Location
    cork, Ireland, Republic of
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: saving fields from a subform (access 2000 vba)

    Hi Hans
    Thanks again for the help and I appreciate you taking the time

    regards Sheila

Posting Permissions

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