Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

error on case statement

Status
Not open for further replies.

5556

Programmer
May 27, 2003
17
0
0
US
The error i am getting is "case without select case." What have i done wrong?



Select Case x

Case "0":

If Len(Trim$(Trip1(0).Text)) > 0 Then
Data3.Recordset("origin") = Trip1(0).Text
End If
If Len(Trim$(Trip1(1).Text)) > 0 Then
Data3.Recordset("stop1") = Trip1(1).Text
End If
If Len(Trim$(Trip1(2).Text)) > 0 Then
Data3.Recordset("stop2") = Trip1(2).Text
End If
If Len(Trim$(Trip1(3).Text)) > 0 Then
Data3.Recordset("stop3") = Trip1(3).Text
End If
If Len(Trim$(Trip1(4).Text)) > 0 Then
Data3.Recordset("stop4") = Trip1(4).Text
End If

Case (1):
If Len(Trim$(Trip2(0).Text)) > 0 Then
Data3.Recordset("origin") = Trip2(0).Text
End If
If Len(Trim$(Trip2(1).Text)) > 0 Then
Data3.Recordset("stop1") = Trip2(1).Text
End If
If Len(Trim$(Trip2(2).Text)) > 0 Then
Data3.Recordset("stop2") = Trip2(2).Text
End If
If Len(Trim$(Trip2(3).Text)) > 0 Then
Data3.Recordset("stop3") = Trip2(3).Text
End If
If Len(Trim$(Trip2(4).Text)) > 0 Then
Data3.Recordset("stop4") = Trip2(4).Text
End If

Case (2):
If Len(Trim$(Trip3(0).Text)) > 0 Then
Data3.Recordset("origin") = Trip3(0).Text
End If
If Len(Trim$(Trip3(1).Text)) > 0 Then
Data3.Recordset("stop1") = Trip3(1).Text
End If
If Len(Trim$(Trip3(2).Text)) > 0 Then
Data3.Recordset("stop2") = Trip3(2).Text
End If
If Len(Trim$(Trip3(3).Text)) > 0 Then
Data3.Recordset("stop3") = Trip3(3).Text
End If
If Len(Trim$(Trip3(4).Text)) > 0 Then
Data3.Recordset("stop4") = Trip3(4).Text

End Select

Data3.Recordset.Update
Next x
 
If Len(Trim$(Trip3(3).Text)) > 0 Then
Data3.Recordset("stop3") = Trip3(3).Text
End If
If Len(Trim$(Trip3(4).Text)) > 0 Then
Data3.Recordset("stop4") = Trip3(4).Text
End If
End Select

You seem to missing an "End If" which probably isn't helping.


Andy
"Logic is invincible because in order to combat logic it is necessary to use logic." -- Pierre Boutroux
"Why does my program keep showing error messages every time something goes wrong?"
 
5556:

You really really need to go back and respond to the other threads that you have started and received input on, not only with a polite "ThankYou", but also with what has worked. Also you need to participate in helping others.
This is a share forum and you risk getting further help.
 

5556:

Your Case statements appear to have different constant types. You have
Code:
Case "0":
while the other cases use a format of
Code:
Case (1):
. Try correcting the case constants.

A couple of questions:
1. Why are adding the colons to the end of each case statment? They're not needed.
2. Why are enclosing the case constants in parentheses?

Per Andy, add the missing
Code:
End If
statement.

Per CCLINT, please be considerate to those who take the time and effort to help you.

Cassie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top