Results 1 to 5 of 5
  1. #1
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Newtown, Pennsylvania, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Open a form with no records in the subform

    I have a form, on which I use a combo box to select records to display in the subform. Problem is when the form first loads, the combo box displays nothing, but the subform has a list of records that seem to be those associated with the first entry in the table that underlies the combo box.

    I am sure I have seen somewhere that it is possible to prevent any records loading in the subform, but how?

    kiwi44

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Open a form with no records in the subform

    Could you make the subform visible=false and only set .visible=true when the selection from the combo-box has been made?
    David Grugeon
    Brisbane Australia

  3. #3
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Newtown, Pennsylvania, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open a form with no records in the subform

    Thanks, that could work - I'll try it when I am more wide-awake! I had thought of trying something fancy with the value of the combo box = zero, but your solution might work better.

    kiwi44

  4. #4
    2 Star Lounger
    Join Date
    Jul 2003
    Location
    Newtown, Pennsylvania, USA
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Open a form with no records in the subform

    This works great. Just two questions - the form.visible=true goes in the 'AfterUpdate' event for the combo box? I currently have the form.visible=false in the 'OnOpen' event for the main form - is this correct, or should it go in the 'OnLoad' - or somewhere else entirely?

    many thanks.

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    Brisbane, Queensland, Australia
    Posts
    352
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Open a form with no records in the subform

    AfterUpdate is right for the comboBox.

    In your situation it makes no difference whether the .visible=false goes in the OnOpen or OnLoad. I would probably use OnOpen in case later you diplay the form by code while it is already open. If you do this the OnOpen does not fire but the OnLoad does. In this circumstance you may want the form to look just as it did when it was last used.

    Glad I have helped.
    David Grugeon
    Brisbane Australia

Posting Permissions

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