Results 1 to 2 of 2
  1. #1
    adamtate94 is offline Novice
    Windows 10 Access 2003
    Join Date
    Sep 2016
    Posts
    7

    If ComboBox help please


    Hi

    I have a combobox on my form which data source is a lookup table in the format:
    1 String1
    2 String2
    3 String3
    4 String4
    5 String5


    I want an event to happen only when the combobox has the values 3 and 4 selected, can i have help with the syntax?
    I have tried ' If cmbType.Column(0) <> 3 or 4 then ...' but it does not work.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Do you want to test for the condition where 3 AND 4 are selected? This is not possible using a Combo. If you want to test for 3 OR 4, you can use the or operator. You only need to use complete statements on each side of the OR operator.

    Code:
    If cmbType.Column(0).Value = 3 OR If cmbType.Column(0).Value = 4 Then
    msgbox "Found either 3 or 4."
    else
    msgbox "3 or 4 was not found."
    end if

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 05-13-2015, 01:14 PM
  2. Replies: 1
    Last Post: 01-16-2015, 09:28 AM
  3. Replies: 1
    Last Post: 09-06-2011, 01:47 PM
  4. Replies: 0
    Last Post: 08-24-2010, 06:38 PM
  5. Replies: 0
    Last Post: 12-16-2009, 01:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums