How would I do something like this?
Like how would I make it say "If the first letter on the selected user doesn't equal @ or + Then..."Code:If Left(Me.lstUsers.Text, 1) != "@", "+" Then
Printable View
How would I do something like this?
Like how would I make it say "If the first letter on the selected user doesn't equal @ or + Then..."Code:If Left(Me.lstUsers.Text, 1) != "@", "+" Then
You are practically there... :)
You can also use Select Case:Code:If Left(Me.lstUsers.Text, 1) <> "@" Or Left(Me.lstUsers.Text, 1) <> "+" Then
Else
End If
Code:Select Case Left(Me.lstUsers.Text, 1)
Case "@", "+"
'do something
Case Else
'do something else
End Select
The above statement will always evaluate to True.Quote:
If Left(Me.lstUsers.Text, 1) <> "@" Or Left(Me.lstUsers.Text, 1) <> "+" Then
Use AND instead of OR when checking for inequality.
If Left(Me.lstUsers.Text, 1) <> "@" AND Left(Me.lstUsers.Text, 1) <> "+" Then
Another way to achieve the same results.
If Not(Left(Me.lstUsers.Text, 1) = "@" Or Left(Me.lstUsers.Text, 1) = "+") Then
In the context I posted it was meant to be "=" instead of "<>", however you are right - "as is" it will always evaluate to True.