Results 1 to 9 of 9
  1. #1
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713

    Unanswered: Chicken or the Egg ... (OR which opens 1st? The form or subform ...)

    Hi all ...

    This one seems simple but I just don't know the answer ... I have a form with a subform. I need to know which opens first (i.e. which Form_Load method will fire 1st)? I need this to do some program initialization ...

    Thanks!!!

    - Mike

  2. #2
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1

    Re: Chicken or the Egg ... (OR which opens 1st? The form or subform ...)

    Originally posted by M Owen
    Hi all ...

    This one seems simple but I just don't know the answer ... I have a form with a subform. I need to know which opens first (i.e. which Form_Load method will fire 1st)? I need this to do some program initialization ...

    Thanks!!!

    - Mike
    The Subform opens at first.

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Ok ... Now with that answered, how do I set the RecordSource of the subform programmatically?

    I've tried this in the main form (within the Form_Load method):

    Forms![Purchase Request Items].RecordSource = ItemsTbl
    Forms![Purchase Request Items].Requery

    AND I get a run-time error on not finding the form ... (which by the way is it's name) ...

    Any Idea?

    Thanks once again ...

    - Mike

  4. #4
    Join Date
    Oct 2003
    Location
    Ger
    Posts
    1,969
    Provided Answers: 1
    Originally posted by M Owen
    Ok ... Now with that answered, how do I set the RecordSource of the subform programmatically?

    I've tried this in the main form (within the Form_Load method):

    Forms![Purchase Request Items].RecordSource = ItemsTbl
    Forms![Purchase Request Items].Requery

    AND I get a run-time error on not finding the form ... (which by the way is it's name) ...

    Any Idea?

    Thanks once again ...

    - Mike
    The subForm has two names, use that under the Properties/Data Tab

  5. #5
    Join Date
    Sep 2003
    Location
    T.O.
    Posts
    326
    Can't you use the me.SbFormName.RecordSource - me.SbFormName.Requery property from the main form where SbFormName is the embedded child object?
    All code ADO/ADOX unless otherwise specified.
    Mike.

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    The subForm has two names, use that under the Properties/Data Tab
    Could you clarify? Which properties? the subform itself or the "subform" control?

  7. #7
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Mike (HomerBoo),

    Can't you use the me.SbFormName.RecordSource - me.SbFormName.Requery property from the main form where SbFormName is the embedded child object?
    Not the RecordSource ... The ReQuery method is exposed ...

  8. #8
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    you saved the form that you are going to use as your subform as something like myPutativeSubform. this may not be the name that the mother form calls it (check out the mother: click once in her subform area and see properties/other/name.

    also... one source of annoyance with A is the subform trying to do something before the mother has got her ducks in line (e.g. trying to show related records before the user selected from a combo on the mother).
    simplest solution to this is to load the mother with the subform hidden and only .visible on combo_update.
    alternative solution is to use a dummy subform (your logo, your copyright notice, blank, whatever) and switch .sourceobject on combo_update

    izy
    currently using SS 2008R2

  9. #9
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    DOH!!! Got it!

    I forgot about the Form method of the subform control ... That exposes the RecordSource property ...

    Ex:

    Me![Purchase Request Items].Form.RecordSource = ItemsTbl
    Me![Purchase Request Items].Requery

    Thanks again!

    - Mike

Posting Permissions

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