I'm having trouble with the AND operator when I used it 3 times.

If Text1.Text = "THIS" And Text2.Text = "THAT" and Text3.Text = "THOSE" then
    Call Display

elseIf Text1.Text = "THIS" And Text2.Text = "THAT" and Text3.Text = "THOSE" then
    Call Display2   

else
    MsgBox"Failed"
End If

It always ends up to the ELSE statement even if all the expressions are TRUE.
When I try to remove the 3rd expression (and Text3.Text = "THOSE"), it works.

Any way to round this? I tried using Goto, Select Case and nested If but does't work also.

The code works fine

Private Sub Command1_Click()
If Text1.Text = "This" And Text2.Text = "That" And Text3.Text = "Those" Then
MsgBox ("1")
ElseIf Text1.Text = "This" And Text2.Text = "That" And Text3.Text = "Those" Then
MsgBox ("2")
Else
MsgBox ("Failed")
End If
End Sub

Private Sub Form_Load()
Text1.Text = "This"
Text2.Text = "That"
Text3.Text = "Those"
End Sub

don't forget the brackets around the msg. Also you will never enter the elseif if thats exactly the same as in the if statement

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.