Thread: trimming characters through VB
February 1st, 2011, 01:34 PM #1
trimming characters through VB
So I'm stumped here as I work on something that will trim characters off when a barcode is scanned. I'm using Sharepoint as my tracking system and what I want to do is create a field that does a "calculated value" off of another field, in which that field will be populated once a barcode is scanned.
The layout for the barcodes is below and I am trying to figure out if it's possible to actually trim from the right 4 characters AND trim off the leading one letter (trailing if I am working from the right).
The barcodes are composed as such: X (all start with this) + "code" (alphanumeric codes that vary in length from 3-6 characters) + date (4 digits in the format of MMDD)
For example "XABC0201" and what I want to parse out and have in it's own calculated field is "ABC" since that is the code I'm looking for. Same with "XCOUNT0808" I want to get "COUNT" only.
Any suggestions?Mobile: Thinkpad T61 | WinXP Pro | C2D T8300 CPU | 3GB DDR2 | 320GB Hybrid SSD HDD | AGN & WWAN
Desktop: Dell XPS 8300 | 3.4 Ghz Intel i7 | 8GB DDR3 | 1TB OS, 1.5TB Mirrored DATA
February 24th, 2011, 12:24 AM #2
- Join Date
- Feb 2011
Dim lstrBarCode as String
Dim lstrMMDD as String
Dim lstrCodePortion as String
lstrBarCode = "XCOUNT0808"
lstrMMDD = Mid$(lstrBarCode, Len(lstrBarCode) - 3) ' lstrMMDD = "0808"
lstrCodePortion = Left$(lstrBarCode, Len(lstrBarCode) - 4) ' lstrCodePortion = "XCOUNT"
lstrCodePortion = Mid$(lstrCodePortion,2) ' lstrCodePortion = "COUNT"
' the last 2 lines could be combined into one line but I broke them out for clarity
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
By Gomer in forum IMO CommunityReplies: 14Last Post: March 18th, 2008, 11:31 AM
By lrivera1 in forum Graphic Design and Digital PhotographyReplies: 13Last Post: August 5th, 2004, 11:13 PM
By Theophylact in forum Suggestion BoxReplies: 17Last Post: July 31st, 2002, 12:15 PM
By wlarsen76 in forum Suggestion BoxReplies: 2Last Post: May 24th, 2002, 03:55 PM
By Southern Belle in forum Applications and Operating SystemsReplies: 14Last Post: January 1st, 2002, 10:27 AM