UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
 
   Reply to this topicStart new topic
> Barcode Scanner Problem, Access 2010    
 
   
dzoker
post Jan 28 2016, 09:34 AM
Post#1



Posts: 371
Joined: 12-February 14



Hi guys,

I always start with I'm new in Access. Long story short I'm making a database where barcode scanner will be used to display a product in a form. This is the code that I use (thanks Google):

Private Sub txtGoTo_AfterUpdate()
If (txtGoTo & vbNullString) = vbNullString Then Exit Sub
Dim rs As DAO.Recordset
Set rs = Me.RecordsetClone
rs.FindFirst "PrID=""" & txtGoTo & """"
If rs.NoMatch Then
MsgBox "Sorry, no such record '" & txtGoTo & "' was found.", _
vbOKOnly + vbInformation
Else
Me.Recordset.Bookmark = rs.Bookmark
End If
rs.Close
txtGoTo = null
End Sub


The problem I have is that if I scan barcode 1234 and then scan the same 1234 barcode after the first one, the form shows the next record.
Record # Barcode Product
1 1234 Banana
2 2222 Apple
3 3333 Peach


So on the first scan of 1234 it will show Banana, if I scan the 1234 again it will show Apple. If I scan 2222 it will show Apple and on the second scan of 2222 it will show Peach. If I scan 2222 for the third consecutive time it will show Apple again.

Thank you
Go to the top of the page
 
dzoker
post Jan 28 2016, 09:48 AM
Post#2



Posts: 371
Joined: 12-February 14



Ok Got it fixed. I set the Cycle Property to Current record and now it stays on the same record no mater how many consecutive times the barcode is scanned.
Go to the top of the page
 
RuralGuy
post Jan 28 2016, 09:50 AM
Post#3


UtterAccess VIP
Posts: 2,798
Joined: 25-June 05
From: @ 8300' in the Colorado Rocky Mountains


Try adding this:
rs.Close
Set rs = Nothing
Go to the top of the page
 


Custom Search
RSSSearch   Top   Lo-Fi    16th December 2017 - 01:42 PM