BozM
asked on
Sorting records alphabetically in VB.net
Hi,
I've got an MS Access table; each record has a column which gives that record's unique alphanumeric code e.g. A0001W, A002W, B001W etc. (The "W" at the end is constant.) When a user creates a new record in the table (through a VB.net application), I need this VB.net application to assign a new code to the new record based on the previous highest value for that letter. So if the Contact's name in the new record is George and the previous highest G code was G056W, I need the program to assign G057W to the new record. I'm using VB.net 2005 with Access XP. Any suggestions would be most welcome. I had something similar working just fine in VBA but now I'm at sea trying to achieve the same in VB.net.
I've got an MS Access table; each record has a column which gives that record's unique alphanumeric code e.g. A0001W, A002W, B001W etc. (The "W" at the end is constant.) When a user creates a new record in the table (through a VB.net application), I need this VB.net application to assign a new code to the new record based on the previous highest value for that letter. So if the Contact's name in the new record is George and the previous highest G code was G056W, I need the program to assign G057W to the new record. I'm using VB.net 2005 with Access XP. Any suggestions would be most welcome. I had something similar working just fine in VBA but now I'm at sea trying to achieve the same in VB.net.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks lads, LSMConsulting gave me the common sense way to structure the database in the first place and Roger gave me the code to work around my current structure. Thanks to both of you.
For your example, you need to isolate the number. You could use something like Mid([uniqueID],2,InStrRev(