Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Jan 2002
    Location
    Delta, Br. Columbia
    Posts
    116
    Thanks
    1
    Thanked 0 Times in 0 Posts
    I have a sub form on which there are 3 different sets of controls. Only 1 set will be visible by the user depending upon a selection made in the 2nd control on the form. I am trying to sue the visible property and change it in VBA depending upon the 2nd control. e.g.

    Private Sub Door_Type_AfterUpdate()
    Select Case Me!Door_Type
    Case 1
    Me!LDoor_Style.Visible
    Me!LDoor_Species_ID.Visible
    Me!LDoor_Factor.Visible
    Case 2
    Me!VDoor_Style.Visible
    Me!VDoor_Species_ID.Visible
    Me!VDoor_Factor.Visible
    Case 3
    Me!PDoor_Style.Visible
    Me!PDoor_Species_ID.Visible
    Me!PDoor_Factor.Visible
    End Select


    End Sub

    However each time I run it I get the message error #438, Object does not support this property or method. The 3 controls being changed consist of 2 unbound combo boxes and 1 unbound text box (they would all be bound to the same fields which is why they are currently not bound. I will update the actual table later when all the data has been entered.

    I am sure I have done this before but stupidly cannot remember how. Any ideas?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts
    Visible is not a method (action) but a property that has to be set to either True or False. You'd have to use code like this:

    Code:
    Private Sub Door_Type_AfterUpdate()
      Select Case Me!Door_Type
    	Case 1
    	  Me!LDoor_Style.Visible = True
    	  Me!LDoor_Species_ID.Visible = True
    	  Me!LDoor_Factor.Visible = True
    	  Me!VDoor_Style.Visible = False
    	  Me!VDoor_Species_ID.Visible = False
    	  Me!VDoor_Factor.Visible = False
    	  Me!PDoor_Style.Visible = False
    	  Me!PDoor_Species_ID.Visible = False
    	  Me!PDoor_Factor.Visible = False
    	Case 2
    	  Me!VDoor_Style.Visible = True
    	  Me!VDoor_Species_ID.Visible = True
    	  Me!VDoor_Factor.Visible = True
    	  Me!LDoor_Style.Visible = False
    	  Me!LDoor_Species_ID.Visible = False
    	  Me!LDoor_Factor.Visible = False
    	  Me!PDoor_Style.Visible = False
    	  Me!PDoor_Species_ID.Visible = False
    	  Me!PDoor_Factor.Visible = False
    	Case 3
    	  Me!PDoor_Style.Visible = True
    	  Me!PDoor_Species_ID.Visible = True
    	  Me!PDoor_Factor.Visible = True
    	  Me!LDoor_Style.Visible = False
    	  Me!LDoor_Species_ID.Visible = False
    	  Me!LDoor_Factor.Visible = False
    	  Me!VDoor_Style.Visible = False
    	  Me!VDoor_Species_ID.Visible = False
    	  Me!VDoor_Factor.Visible = False
      End Select
    End Sub

Posting Permissions

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