Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Posts
    192
    Thanks
    0
    Thanked 0 Times in 0 Posts

    How to refer to the subform (Access 2000)

    In the OnOpen event of the main form, how to refer to the subform and give a command for the record source of the subform?

    I have 2 forms, a main form called Main and a subform called [Orders Subform].depending on the choice of the option buttons,
    i apply diferent source to the form.I have also to apply a different source to the subform, but how to refer to the subform?

    In the OnOpen event of the main form i have the following code:

    Me.RecordSource = StrBas
    ( strbas is a query for a given kind of events)

    It works, but now i want to refer to the subform and write:

    Me![Orders Subform].RecordSource = StrBasSub


    The above code is not valid, may be somebody may show me how to refer to the subform and apply a source to the RecordSource property?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: How to refer to the subform (Access 2000)

    The reason it's invalid is because [Orders Subform] refers to the subform control on the parent form, not to the subform that populates that control. To set the recordsource, you have to reference the actual subform form like this:

    Me![Orders Subform].Form.Recordsource = strBasSub
    Charlotte

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: How to refer to the subform (Access 2000)

    Hi Aral

    See The Access Web http://www.mvps.org/access/forms/frm0031.htm

    and

    Rogers Access Library www.rpgersaccesslibraby.com

    for handy reference and sample db

    HTH

    John

Posting Permissions

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