I have deposit tickets that are formatted like this.. 060112-1 and will increase the last digit as tickets are entered for that day... So if there were 11 tickets on 6/1/12 they would be listed as below..
060112-1
060112-2
060112-3
060112-4
060112-5
060112-6
060112-7
060112-8
060112-9
060112-10
060112-11
For ordering purposes i am sorting by Deposit Ticket iD as above. The problem is it 10 is sorted right after one.. for instance my sort in listbox looks like this..
060112-1
060112-10
060112-11
060112-2
060112-3
060112-4
060112-5
060112-6
060112-7
060112-8
060112-9
My solution was to pull the "subID" which would be the last digit after "-" for sorting.. I created a function but cant seem to get it to work. Im unfamilar with this method.. Help!!
Function:
Public Function GetSubTicketID(CRID As String) As String
Dim TmpID As String
Dim SUBID As String
TmpID = CRID
SUBID = InStr(1, TmpID, "-")
Debug.Print TmpID
Debug.Print SUBID
End Function
IMMEDIATE WINDOW:
INPUT -?GetSubTicketID("052912-9")
Debug -
052912-9
7
Its getting the string correct.. But pulling a 7.. that should be a 9.
060112-1
060112-2
060112-3
060112-4
060112-5
060112-6
060112-7
060112-8
060112-9
060112-10
060112-11
For ordering purposes i am sorting by Deposit Ticket iD as above. The problem is it 10 is sorted right after one.. for instance my sort in listbox looks like this..
060112-1
060112-10
060112-11
060112-2
060112-3
060112-4
060112-5
060112-6
060112-7
060112-8
060112-9
My solution was to pull the "subID" which would be the last digit after "-" for sorting.. I created a function but cant seem to get it to work. Im unfamilar with this method.. Help!!
Function:
Public Function GetSubTicketID(CRID As String) As String
Dim TmpID As String
Dim SUBID As String
TmpID = CRID
SUBID = InStr(1, TmpID, "-")
Debug.Print TmpID
Debug.Print SUBID
End Function
IMMEDIATE WINDOW:
INPUT -?GetSubTicketID("052912-9")
Debug -
052912-9
7
Its getting the string correct.. But pulling a 7.. that should be a 9.