I have little problem when I get the data(bar code) from Com-port to access 97. These looks like below: Why does a code will be sometime in two recordfiel boxs??
http://students.oamk.fi/~rajata01/example.JPG
...
This is the code what is in VBA.
Private Sub MSComm2_OnComm()
Dim buffer As String
Dim T1 As Single
buffer = MSComm2.CommEvent
T1 = Timer
Do Until buffer = 2
If Timer - T1 > 3 Then Exit Sub
Loop
Call AddScanRecords
End Sub
Sub AddScanRecords()
Dim db As Database, rs As DAO.Recordset
Dim StartTime As Date
StartTime = Now()
Set db = CurrentDb
Set rs = db.OpenRecordset("kone1")
rs.AddNew
rs![BarCode] = MSComm2.Input
rs![ScanDate] = Now()
rs.Update
rs.Close
db.Close
End Sub
How I can do the buffer like this...http://msdn.microsoft.com/library/default.asp?url=/library/en-us/comm98/html/vbobjcommx.asp
I can use Data Packet Separators in barcode scanner.
Example
Data Packet Separator #1 is defined as CR (0DH) and Data Packet Separator #2 is defined as LF (0AH).
Both separators will be sent together.
... <DATA PACKET #1> <CRLF> <DATA PACKET #2> <CRLF> etc
http://students.oamk.fi/~rajata01/example.JPG
...
This is the code what is in VBA.
Private Sub MSComm2_OnComm()
Dim buffer As String
Dim T1 As Single
buffer = MSComm2.CommEvent
T1 = Timer
Do Until buffer = 2
If Timer - T1 > 3 Then Exit Sub
Loop
Call AddScanRecords
End Sub
Sub AddScanRecords()
Dim db As Database, rs As DAO.Recordset
Dim StartTime As Date
StartTime = Now()
Set db = CurrentDb
Set rs = db.OpenRecordset("kone1")
rs.AddNew
rs![BarCode] = MSComm2.Input
rs![ScanDate] = Now()
rs.Update
rs.Close
db.Close
End Sub
How I can do the buffer like this...http://msdn.microsoft.com/library/default.asp?url=/library/en-us/comm98/html/vbobjcommx.asp
I can use Data Packet Separators in barcode scanner.
Example
Data Packet Separator #1 is defined as CR (0DH) and Data Packet Separator #2 is defined as LF (0AH).
Both separators will be sent together.
... <DATA PACKET #1> <CRLF> <DATA PACKET #2> <CRLF> etc
Last edited: