0

Why is this If Statement not recognising the Then's and is just saying "Expression Expected" with a blue underline under the two last Then's, the first one is fine.

If fst <> "" And lst = "" Then
    cmd = New OleDbCommand("SELECT * FROM Customers WHERE FirstName='" & fst & "';", cn)
ElseIf fst = "" And lst = <> Then
    cmd = New OleDbCommand("SELECT * FROM Customers WHERE Surname='" & lst & "';", cn)
ElseIf fst <> "" And lst = <> Then
    cmd = New OleDbCommand("SELECT * FROM Customers WHERE Surname='" & lst & "' AND FirstName='" & fst & "';", cn)
End If
GSerg
  • 76,472
  • 17
  • 159
  • 346
Figrol
  • 5
  • 1

1 Answers1

0
If fst <> "" And lst = "" Then
    ' statement...
ElseIf fst = "" And lst = "" Then
    ' statement...
ElseIf fst <> "" And lst = "" Then
    ' statement...
End If
Neverr Myndd
  • 1
  • 1
  • 1