Is some wrong in code...

jeppe

Registered User.
Local time
Today, 02:30
Joined
Jun 5, 2006
Messages
16
Private Sub Form_Load()

MSComm1.CommPort = 1
MSComm1.Handshaking = 0
MSComm1.Rthreshold = 0
MSComm1.Settings = "9600,N,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True

End Sub


Private Sub MSComm1_OnComm()
AddScanRecords_Open
End Sub

Sub AddScanRecords()

Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim StartTime As Date

StartTime = Now()

Set cn = CurrentProject.Connection
Set rs = New ADODB.Recordset

rs.Open "ScanResults", cn, adOpenKeyset, adLockOptimistic ' ScanResults is the name of the table

Do While Now() < StartTime + TimeSerial(0, 0, 1) ' test run for one second - can Add hours Or minutes
rs.AddNew
' this is where you would wait for and insert the bar code.
rs![BarCode] = MSComm1.Input ' BarCode is the field name you would replace "testthissub" with the bar code input
rs![ScanDate] = Now()
rs.Update
Loop

MSComm1.PortOpen = False ' Close the com port

End Sub
 
Try:
Code:
Private Sub MSComm1_OnComm()
Call AddScanRecords
End Sub
 
I have some problem whit MSComm-object.

Run-time error '424':
Object Required

rs![BarCode] = MSComm1.Input
 

Users who are viewing this thread

Back
Top Bottom