Results 1 to 3 of 3

Thread: Syntax question

  1. #1
    Join Date
    Dec 2002
    Posts
    97

    Unanswered: Syntax question

    I'm trying to reference a subform in a tab control which is contained in a master form.

    When I try to reference the subform in my VB it comes back that the form doesn't exist. Do I reference the subform directly in the code or do I have to nest the references?

    The code is

    dim frm as Forms

    Set frm = Forms![frmSub_Client]

    If frm![Sal] = "Other" Then frm![Sal_Othr].Visible = True

    Else

    frm![Sal_Othr].Visible = False

    Thanks for your help.
    Chris

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    Don't wory about creating a Form object. To reference a control on a subform use the following syntax:

    Me.Subform.Form.ControlName

    In your case something like:

    Me.frmSub_Client.Form.Sal_Othr.Visible = True

    The key to remember is to use the Form property of the subform to refer to anything on the subform.

  3. #3
    Join Date
    Dec 2002
    Posts
    97

    Thanks...

    Thank you for the help.

    I'll admit...I usually don't use Me since most of the time I get confused as to what I'm referencing!

    Well..it's back to VB-land.

    -C

Posting Permissions

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