15 pts.
 Remove Q in Microsoft Access
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:
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 -----------
Last Wiki Answer Submitted:  April 22, 2010  11:30 pm  by  carlosdl   63,580 pts.
All Answer Wiki Contributors:  carlosdl   63,580 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Carlos,

I still need it to do a sum to compare during scanning. Thank you very much for your time.

 15 pts.