Scott-Atkins
New member
- Local time
- Today, 14:09
- Joined
- Apr 11, 2010
- Messages
- 1
Hi All,
Im new to Vb6 and im just putting together something basic and for some reason reason i keep getting "else without if" error, what i want to do is when some one types in a name it will return there address etc, but it throws a "else without if" error. help will be much appreciated.
Private Sub Command5_Click()
Dim response As String
Dim Scott_Atkinon As String
Dim James_Ludlow As String
Dim Mark_webster As String
Dim Gareth_Hughes As String
If txt1.Text = ("Scott_Atkinson") Then
response = MsgBox("83 new hythe lane, Larkfield, ME20, Kent")
Else: txt1.Text = ("James_Ludlow")
response = MsgBox("27 Tonbridge road, ME17, Kent")
Else: txt1.Text = ("Mark_Webster")
response = MsgBox("47 Sunningdale Road, Maidstone, ME34, Kent")
Else: txt1.Text = ("Gareth_Hughes")
response = MsgBox("36 London Road, Maidstone, ME34, Kent")
End If
End Sub
The error is thrown on the 2nd Else statement. I have tried a few things i.e have all if statements with End if after,
If some one can help me it would be much appreciated.
Thanks in Advance
Im new to Vb6 and im just putting together something basic and for some reason reason i keep getting "else without if" error, what i want to do is when some one types in a name it will return there address etc, but it throws a "else without if" error. help will be much appreciated.
Private Sub Command5_Click()
Dim response As String
Dim Scott_Atkinon As String
Dim James_Ludlow As String
Dim Mark_webster As String
Dim Gareth_Hughes As String
If txt1.Text = ("Scott_Atkinson") Then
response = MsgBox("83 new hythe lane, Larkfield, ME20, Kent")
Else: txt1.Text = ("James_Ludlow")
response = MsgBox("27 Tonbridge road, ME17, Kent")
Else: txt1.Text = ("Mark_Webster")
response = MsgBox("47 Sunningdale Road, Maidstone, ME34, Kent")
Else: txt1.Text = ("Gareth_Hughes")
response = MsgBox("36 London Road, Maidstone, ME34, Kent")
End If
End Sub
The error is thrown on the 2nd Else statement. I have tried a few things i.e have all if statements with End if after,
If some one can help me it would be much appreciated.
Thanks in Advance