If RowIDList.Size > 0 Then
If CurrentIndex = -1 Or CurrentIndex > RowIDList.Size - 1 Then
CurrentIndex = 0 'set the current index to 0
End If
Else
CurrentIndex = -1 'set the current index to -1, no selected item
ToastMessageShow("No items found", False)
End If
ResultSet1.Close 'close the ResultSet, we don't need it anymore