Remove Q in Microsoft Access

15 pts.
Tags:
Microsoft Access
Microsoft Access forms
I have a form that I scan a barcode with quantity and barcode has Q20. I need it to record on table with 20. Removing the Q. Can this be done on a numeric filed or does it have to be done on a text field. Is there a code to eliminate the q from the field when the barcode is scanned.

Software/Hardware used:
microsoft access
ASKED: April 22, 2010  4:44 PM
UPDATED: April 23, 2010  3:50 PM

Answer Wiki

Thanks. We'll let you know when a new response is added.

I think you will need to do this using a text field, because a numeric one will probably cause an error before trying to remove the ‘Q’.

I hope someone else provides a better solution, but meanwhile…

You could use an unbound text field and in the ‘AfterUpdate’ event remove the ‘Q’ and assign the resultant value to your quantity field (which should be hidden). Then, in some form event such as ‘Current’ you could copy the value from your hidden quantity field to your visible unbound text field, so users can see what is in your database field when using the form to read.

Assuming a text field ‘Text1′, the code would be something like this:

<pre>Private Sub Form_Current()
Text1 = quantity
End Sub

Private Sub Text1_AfterUpdate()
If Left(Text1, 1) = “Q” Then
quantity = Mid(Text1, 2)
Else
quantity = Text1
End If
End Sub</pre>

Other validations should be performed in order to ensure that Text1 doesn’t contain other non-numeric characters.

Hope this helps.

-CarlosDL

———–

Discuss This Question: 1  Reply

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • Danielsang
    Carlos, I still need it to do a sum to compare during scanning. Thank you very much for your time.
    15 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following