change text after scanning to remove first 2 characters from scan (1 Viewer)

hullstorage

Registered User.
Local time
Today, 07:00
Joined
Jul 18, 2007
Messages
213
Hi all, we use a scanner to scan part barcodes when booking in to stock

example of part number on label
PWR-C5-600WAC=
actual scan inputs in field as
1PPWR-C5-600WAC=

so as you can see it add 1P which is what we need to remove

same as serial
ART2509D1S9

actual scan
SART2509D1S9

so need to remove the S

sometime the barcode will be damaged so need to take in to account the user will only input what they see from the label which does not show the 1P and the S

Cheers
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:00
Joined
Sep 21, 2011
Messages
14,299
So check if the first two characters are 1P, (or first character is an S) and if they are use Right() or Mid() to get rid of them?
 

hullstorage

Registered User.
Local time
Today, 07:00
Joined
Jul 18, 2007
Messages
213
is this after update event and can you give example please - field name is PartNo and SerialNo
 

Gasman

Enthusiastic Amateur
Local time
Today, 07:00
Joined
Sep 21, 2011
Messages
14,299
Yes, AfterUpdate event of the control would be the place I would add my code.
Just look up those functions, plenty of examples already out there. You would also need the Len() function.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:00
Joined
Feb 19, 2002
Messages
43,275
What is causing the extra characters?
What is the pattern of extra characters?
How do you know how many characters to remove?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:00
Joined
Feb 28, 2001
Messages
27,186
I've been out for a walk so missed this question earlier, but Pat has hit the target squarely... as she usually does.

If there is a pattern to the removal, we need to know what it might be. But of greater importance is how Access will be able to know what actually happened during the scan. Your characters to be removed don't follow a clear pattern and the characters to be retained don't follow a clear pattern either. I am going to have to say that without more information, I believe you cannot do this by simple programming. I will add more to Pat's list...

How do you know how many characters to keep?
How can you decide that a barcode was damaged?

And I will point out that if YOU can't answer these questions, neither can Access. And neither can we.

Understand this: Access is dumber than a box of rocks when it comes to the real world. All Access knows how to do is make tables, queries, forms, reports, macros, and modules. It is up to you to provide any other knowledge needed for the operation.
 

Users who are viewing this thread

Top Bottom