The array is declared as dynamic and i is set to 0 via a cmdButton that is used before this sub is activated. Iwant the array to increment each time this click event is fired, storing the result each time. Can anyone see whats wrong please, I'm a newbie.
Private Sub lblSeat_Click(Index As Integer)
Dim Found As Boolean
Dim CurIndex As Integer
Dim msgResponse As Integer
If CheckOpt(Found) Then 'No type selected(Adult,Child etc)
Exit Sub
End If
MsgBox i, , "First Check"
CurIndex = lblSeat(Index).Index
ReDim Preserve SeatNumAray(i To x)
If SeatNumAray(i) = "" Then
x = i + 1
ReDim Preserve SeatNumAray(i To x)
SeatNumAray(i) = lblSeat(Index).Tag
Else
i = i + 1
x = x + 1
ReDim Preserve SeatNumAray(i To x)
SeatNumAray(i) = lblSeat(Index).Tag
End If
MsgBox SeatNumAray(i), , "BlaBla"
If lblSeat(CurIndex).BackColor = &H80000009 Then 'White'ish
lblSeat(CurIndex).BackColor = SeatColor
SeatRecs (CurIndex) ' Save the seat record here
Exit Sub
Else
msgResponse = MsgBox("You cannot re-select this seat" & vbCrLf & "Would you like to change this seat booking?", vbExclamation + vbMsgBoxHelpButton + vbYesNo, "WARNING"
If msgResponse = vbYes Then
Call lblSeat_DblClick(CurIndex) 'Hopefully use this to Delete the present record for this seat and allow the user to re-select
End If
Exit Sub
End If
End Sub
Private Sub lblSeat_Click(Index As Integer)
Dim Found As Boolean
Dim CurIndex As Integer
Dim msgResponse As Integer
If CheckOpt(Found) Then 'No type selected(Adult,Child etc)
Exit Sub
End If
MsgBox i, , "First Check"
CurIndex = lblSeat(Index).Index
ReDim Preserve SeatNumAray(i To x)
If SeatNumAray(i) = "" Then
x = i + 1
ReDim Preserve SeatNumAray(i To x)
SeatNumAray(i) = lblSeat(Index).Tag
Else
i = i + 1
x = x + 1
ReDim Preserve SeatNumAray(i To x)
SeatNumAray(i) = lblSeat(Index).Tag
End If
MsgBox SeatNumAray(i), , "BlaBla"
If lblSeat(CurIndex).BackColor = &H80000009 Then 'White'ish
lblSeat(CurIndex).BackColor = SeatColor
SeatRecs (CurIndex) ' Save the seat record here
Exit Sub
Else
msgResponse = MsgBox("You cannot re-select this seat" & vbCrLf & "Would you like to change this seat booking?", vbExclamation + vbMsgBoxHelpButton + vbYesNo, "WARNING"
If msgResponse = vbYes Then
Call lblSeat_DblClick(CurIndex) 'Hopefully use this to Delete the present record for this seat and allow the user to re-select
End If
Exit Sub
End If
End Sub