Trimming data

G

Guest

Hi guys,
I need some assistance with trimming part of the data string that is entered
(scanned) in field. Here is the situation;
I have form called frmReceived and one the form there is a text field called
CaseNo.
I can scan (via barcode scanner) some barcodes in the unfinished database
just fine but my manager want's me to trim suffix on the case if one exists.
There are 2 types of case structure; 22050-03700 and 0722-AC03061, there
could be also suffixes to these cases like -01 or -02 (22050-03700-01), I
would like to trim these suffixes as the data is scanned. I'm not sure how to
validate the case and say delete last 3 values if there is a suffix to the
case.
I tried using input mask but the best I can get is when they scan the case
in - or 0 will show up in the end.. neither is good enough.
Thanx in advance and I hope you guys can help me out.
 
D

Damon Heron

This will work-

Dim strlen As Integer
strlen = Len(CaseNo)
If Mid(CaseNo, (strlen - 2), 1) = "-" Then
Me.CaseNo = Left(CaseNo, strlen - 3)
End If

Damon
 
G

Guest

That works great!!!

Thanx and take care


Damon Heron said:
This will work-

Dim strlen As Integer
strlen = Len(CaseNo)
If Mid(CaseNo, (strlen - 2), 1) = "-" Then
Me.CaseNo = Left(CaseNo, strlen - 3)
End If

Damon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Me and Mid 3
Mid in query 5
tab to next field on afterupdate 3
Trimming Names 2
BARCODE IN ACCESS 4
Auto Detect Data, Auto Print Data, Auto Erase Data Loop 8
Delaying an Event 2
#error 14

Top