the
database, to make txtName and txtPrice empty.
To do this, just left the Recordsource for the form empty, left txtName
and
txtPrice unbound, and use the following code:
Private Sub txtCode_AfterUpdate()
Dim rs As Recordset, bm
Set rs = currentdb.OpenRecordset("select * from YourItemsTableName
where
ProdID='" & me.txtCode & "'")
if rs.recordcount >0 then
me.txtName = rs![NameProdField]
me.txtPrice = rs![PriceProdField]
Else
MsgBox "This product doesn't exist in database!"
me.txtName = null
me.txtPrice = null
End If
Set rs = Nothing
End Sub
HTH,
Bogdan
-----------------------------------
Freelance programmer
Hello,
Has anyone tried using a bar code scanner kind of application using
MS
Access? If so will appreciate some ideas and tips on how to go about
creating one.
Basically, there are two kind of bar code readers. First of them works
on
keyboard interface. They connect to the kb in on the mainboard and
offers
another kb type connector, just to connect your regular keyboard.
When you scan a code, the computer think it was typed at the keyboard
(so
you can use it to scan in every textbox field. Also, after finishing
scanning, it also send <Enter> key code.
To interface with it, you should write some code in some of the
following
events : AfterUpdate, BeforeUpdate, LostFocus, OnExit, etc. The code
basically will read the value from the textbox, and then perform the
required search.
Another type of barcode readers uses serial interface (RS232)
To work with them, you need to work with the COM port, using various
approaches (using API to access the COM port, using some AxtiveX lime
MSCOMM.OCX, etc)
HTH,
Bogdan Zamfir
______________________________
Freelance developer
Hello,
Has anyone tried using a bar code scanner kind of application using
MS
Access? If so will appreciate some ideas and tips on how to go about
creating one.
Thanks and Regards
--
Fakhruddin Zavery
Sr. Systems Analyst / Programmer
CATS Tanzania Ltd.
NIC Life House 4th Floor
P. O. Box 2569, Dar es Salaam, Tanzania
Tel. +255-22 2137915, 2112631
Fax +255-22 2113033, 2112916
Mob +255 744 277452
website:
http://www.catsgroup.com