Results 1 to 10 of 10
  1. #1
    Join Date
    Jun 2004
    Posts
    31

    Unanswered: Problems hiding fields in subform

    I have a main form with a subform that has several fields(text boxes). Based on a combo box located on the main form, I am attempting to show/hide fields(located on the subform) based on selection. whenever I setup de code, I get an error-

    Me.Giros.Visible = False
    the above command returns the error. Can anyone tellme what is wrong with this code?

  2. #2
    Join Date
    Nov 2002
    Location
    The Netherlands
    Posts
    61
    What kind of error are you getting?

  3. #3
    Join Date
    Jun 2004
    Posts
    31
    The portion with the '[Giros]!giro1.Visible = False' statement below ends up highlighted in yellow. Whenever I try to execute the code from the main form, I am prompted to debug....
    Private Sub Tiempo_AfterUpdate()
    Dim Tiempo As ComboBox
    Dim giro1 As TextBox

    [Giros]!giro1.Visible = False


    End Sub

  4. #4
    Join Date
    Jun 2004
    Location
    Terrapin Nation
    Posts
    205
    Thats not the right way to reference a control on a subform.

    Forms![frmMain]![frmSubFrom].Form![txt_Date]

  5. #5
    Join Date
    Nov 2002
    Location
    The Netherlands
    Posts
    61
    Quote Originally Posted by peto813
    The portion with the '[Giros]!giro1.Visible = False' statement below ends up highlighted in yellow. Whenever I try to execute the code from the main form, I am prompted to debug....
    Private Sub Tiempo_AfterUpdate()
    Dim Tiempo As ComboBox
    Dim giro1 As TextBox

    [Giros]!giro1.Visible = False


    End Sub
    Why are using variables for controls?
    Maybe thats the problem

  6. #6
    Join Date
    Jun 2004
    Posts
    31
    Evidently I am new at this, would you mind posting an example? Thank you in advance.

  7. #7
    Join Date
    Nov 2002
    Location
    The Netherlands
    Posts
    61
    Well if you are using an event you can do this:


    Private Sub Tiempo_AfterUpdate()

    [Giros]!giro1.Visible = False

    End Sub


    If Giro1 is a control on your form

  8. #8
    Join Date
    Jun 2004
    Posts
    31
    Thank you but I gave that a shot and the portion was still highlited by the compiler!
    Giro1, is a text field located in a subform, the control is a combo box located on the main form that is intented to tell the fields in the subform to show.hide...

  9. #9
    Join Date
    Nov 2002
    Location
    The Netherlands
    Posts
    61
    The subform is on the form and counts as a control too.
    To goto it you can do 3 things.
    If your in the module of the parent Form.

    Me.subformname.controls("Giro1").visible=false

    If you're in the module of the form the control is on.

    Me.controls("Giro1").visible=false

    and if its not any of thse 2

    [Formname].subformname.controls("Giro1").visible=false

    I hope this helps
    Last edited by DeathWing; 06-28-04 at 11:08.

  10. #10
    Join Date
    Jun 2004
    Posts
    31
    Thank you for your help, I believe I was missing the "controls" portion of the statement.

Posting Permissions

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