Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Forms and Barcodes

Status
Not open for further replies.

Danielvb

Programmer
Oct 8, 2002
34
US
Hi team:

Plaease I need some help. I wrote a small application in Visual Basic 6.0 that scan barcodes and I am posting a little part of the code.

NOW I am writing an Application in Access 2002 that has:

-- One textbox for that will capture the barcode info

-- The user scan the barcode using a scanner

-- if the information is valid (in this case numeric), the application will search in the
table to match the item number of that product and get the specification. Then, if the Application find the item number, the App will display the information of the product in the same form

-- Which EVENT can I use in the Access Form to reuse the code below or can you help me out with one example?


Thanks in advance for your time


Daniel
vbbeginner@aol.com
Hollywood, FLorida
USA



THIS CODE WAS DONE IN VISUAL BASIC 6.0
I have a Form named frmGetScanInfo
The form has a textbox named txtInfo.Text


==============================================
SOURCE CODE FOR THE frmGetScanInfo FORM

Public pScanInfo as string



Private Sub Form_Load()
'** KeyPreview must be set to True so the scanned data can be evaluated
txtInfo.Text = ""
Scanner_Activation_Form.KeyPreview = True
End sub



Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = 126 Then
KeyAscii = 0 '** Reset the KeyAscii to 0
End If
End Sub


'*** The user scan the barcode and text box gets the info and process
Private Sub txtEmployeeInfo_KeyPress(KeyAscii As Integer)
If (KeyAscii = vbKeyReturn) Then

Let pScanInfo = Trim(txtEmployeeInfo.Text)
if (pScanInfo = "") then
'Display an error message
else
'Process the info
end if
end sub
 
In Access, you usually use a onBeforeUpdate or an onAfterUpdate event. Using one of those events, you do not have to trap each keystroke or mouseclick, but you act only whenever a complete value is entered. Beware that there is a difference between the
Code:
Text
property and the
Code:
Value
property of the textbox when you use the onBeforeUpdate event. The
Code:
Text
propery contains a string with the current input.

Best regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top