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
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