Results 1 to 7 of 7
  1. #1
    Join Date
    Mar 2013
    Posts
    70

    Unanswered: Visible Not Working

    Access 2013

    Can anyone tell me why the first sub works and the second does not? The control 'chkCondoPU' is set to visible = yes in property sheet. Third sub is so it will refresh when I change records.
    cmbCustType = text in combo box
    chkCondoPU = y/n field
    No debug errors.

    Thanks, Scott

    Code:
    Option Compare Database
    Option Explicit
    
    Private Sub chkCondoPU_Click()
    
    If Me.chkCondoPU = True Then
    DoCmd.OpenForm "frmCondoContacts", , , "[customerLU]=" & Me![nameID]
    Me.cmdOpenCondContactsFrm.Visible = True
    End If
    
    End Sub
    
    Private Sub cmbCustType_AfterUpdate()
    
    If Me.cmbCustType = "Condo" Then
    Me.chkCondoPU.Visible = True
    Else
    Me.chkCondoPU.Visible = False
    End If
    
    End Sub
    
    Private Sub Form_Current()
    
    If Me.cmbCustType = "Condo" Then
    Me.chkCondoPU.Visible = True
    Else
    Me.chkCondoPU.Visible = False
    End If
    
    End Sub

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    First thing is to determine whether the code in Form_Current () is executed or not : set a breakpoint there or add a Stop instruction in the prodecure.
    Have a nice day!

  3. #3
    Join Date
    Mar 2013
    Posts
    70
    It stops at the first line of the 3rd sub (Form_Current):

    If Me.cmbCustType = "Condo" Then

    The code has not worked since I wrote it. The code originally did not have the Form_Current sub. It did not work then either.

    Best, Scott

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You're sure that there is a selection "Condo?"

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    Mar 2013
    Posts
    70
    yes. I checked and double checked that first. This makes no sense. this is simple code that has worked a a hundred times before. I was just making a sanity check that I did not do something stupid. so I guess you do not see anything out of the ordinary either?

  6. #6
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    OK ! So the Form_Current() event handler is executed and the value "Condo" is among the possible selections. Next step: Is the Bound Column of the the combo the one that can contain "Condo" (in case the combo has more than one column)?
    Have a nice day!

  7. #7
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Good point! If the RowSource of cmbCustType is a Table or Query, and it has Primary Key, Access has a habit of including the PK when it creates a Combobox, without the developer being aware of this, and making this the Bound column, rather than the column that, in this case, contains "Condo." I just someone else's problem where this very thing occurred!

    Linq ;0)>
    Last edited by Missinglinq; 06-16-14 at 12:43.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Tags for this Thread

Posting Permissions

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