MSComm and ADO-problems (1 Viewer)

jeppe

Registered User.
Local time
Today, 14:53
Joined
Jun 5, 2006
Messages
16
I have problems open the MSComm and ADO-connection. I don't know what is wrong..below is the code.

Option Compare Database

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()
Call AddScanRecords
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 "Kone1", cn, adOpenKeyset, adLockOptimistic ' Kone1 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 "MSComm1.Input" with the bar code input
rs![ScanDate] = Now()
rs.Update
Loop

MSComm1.PortOpen = False ' Close the com port

End Sub

I am added the MSComm.ocx to Active-X Controls. In refenrences I added Microsoft Comm Control 6.0, Data Objects 2.5.

I can't open MSComm and ADO-object.

Errors references are:

MSComm1.CommPort = 1
Set cn = CurrentProject.Connection

I need help quickly :confused: ?

Access 97/win2000

Thanks
 
Last edited:

Users who are viewing this thread

Top Bottom