Using IndexOf or an alternative?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hey Peeps

I have the below code, that for some reason says i have an invaliud
qualifier at the line 'Shore = Start.Remove(**Start**.IndexOf(Boat),
Start.IndexOf(Boat) + 2)' and highlights the part where i've put stars around
it.

T1 = AB, T2 = A, T3 = AC, T4 = A, T5 = AD

The values of T1 - T5 can change but they will keep the same format.

Hope you can help in anyway

Private Sub River___Try_Click()

T1 = Forms!Pilot!River_Trip1
T2 = Forms!Pilot!River_Trip2
T3 = Forms!Pilot!River_Trip3
T4 = Forms!Pilot!River_Trip4
T5 = Forms!Pilot!River_Trip5
Dim Start As String
Dim Shore As String
Dim Boat As String
Dim Island As String

'Initial
Start = "ABCD"

'Trip 1
Boat = T1
Shore = Start.Remove(Start.IndexOf(Boat), Start.IndexOf(Boat) + 2)
Shore = Shore.Remove(Start.IndexOf(Island), Start.IndexOf(Island) + 1)

'Trip 2
Boat = T2
Island = Start.Remove(Start.IndexOf(Boat), Start.IndexOf(Boat) + 1)
Island = Island.Remove(Start.IndexOf(Shore), Start.IndexOf(Shore) + 1)

'Trip 3
Boat = T3
Shore = Start.Remove(Start.IndexOf(Boat), Start.IndexOf(Boat) + 2)
Shore = Shore.Remove(Start.IndexOf(Island), Start.IndexOf(Island) + 1)

'Trip 4
Boat = T4
Island = Start.Remove(Start.IndexOf(Boat), Start.IndexOf(Boat) + 1)
Island = Island.Remove(Start.IndexOf(Shore), Start.IndexOf(Shore) + 1)

'Trip 5
Boat = T5
Shore = Null

'End
Island = Island & Boat
MsgBox Island

End Sub
 
That looks like VB.NET code. Are you trying to use it in Access? If so, that
won't work, you need to use VBA.
 
Back
Top