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

    Unanswered: Multiple Then Elses in an IF THEN ELSE statement

    I am trying to disable three fields in a form if it meets the IF condition. Can one do multiple THEN ELSEs? If so what is wrong with the following code.

    Many Thanks, Scott

    Code:
    Private Sub cboItemType_AfterUpdate()
    
    If cboItemType = "2" Then
    cbo800InvFK.Enabled = False AND
    cbo800Qty.Enabled = False AND
    cboLevel.Enabled = False
    Else
    cbo800InvFK.Enabled = True AND
    cbo800Qty.Enabled = True AND
    cboLevel.Enabled = True
    End If
    
    End Sub
    Last edited by healdem; 01-10-14 at 12:51. Reason: added extra / to terminate [CODE] TAG

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    No need to add a logical operator:
    Code:
    Private Sub cboItemType_AfterUpdate()
    
        If cboItemType = "2" Then
            cbo800InvFK.Enabled = False
            cbo800Qty.Enabled = False
            cboLevel.Enabled = 
        Else
            cbo800InvFK.Enabled = True 
            cbo800Qty.Enabled = True 
            cboLevel.Enabled = True
        End If
    
    End Sub
    Have a nice day!

Posting Permissions

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