Link to home
Start Free TrialLog in
Avatar of Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.Sc
Hankwembo Christopher,FCCA,FZICA,CIA,MAAT,B.A.ScFlag for Zambia

asked on

How to allow Multiple usage of the serial port- Ms Access 2016/2019

After working very well and successfully with the serial port for the purpose of tax invoices production by attaching the gadget to one user all was very fine no issues at all, now the manufacturer added a new feature which allows the gadget to be shared on the network by four extra users provided the users are on the same network.
 
We are using a router meaning essentially, we are on the same network, but the gadget cannot be opened by another user except where it is attached, we contacted the gadget supplier and their response is that, just ensure you are all on the same network and call 8.8.8.8
 
Below is the VBA we are using to open the gadget:
 
Public Sub CmdCOpen_Click()
On Error GoTo Err_Handler
Dim Cancel As Integer
Dim intPortID As Integer ' Ex. 1, 2, 3, 4 for COM1 - COM4
Dim lngStatus As Long
Dim strError  As String
If IsNull(Me.CboInvoices) Then
Beep
MsgBox "Please select the invoice number to sign off now", vbOKOnly, "Invoice number not selected"
Cancel = True
Exit Sub
ElseIf (DLookup("InvoiceNumber", "tblDreceipts", "INVID =" & [CboInvoices]) <> "") Then
Beep
MsgBox "Please note that this invoice is already signed by the gadget, select another one", vbOKOnly, "Try again"
Cancel = True
Exit Sub
End If
intPortID = Forms!frmLogin!txtFinComPort.value ‘ COM 4
' Initialize Communications
lngStatus = CommOpen(intPortID, "COM" & CStr(intPortID), "baud=115200 parity=N data=8 stop=1")
If lngStatus <> 0 Then
' Handle error.
MsgBox Err.Number & Err.Description, vbExclamation, "Error"
Application.Quit
ElseIf lngStatus = 0 Then
Beep
MsgBox "Please note that the port is open now", vbOKOnly, "Start processing the invoice details now"
End If
' Set modem control lines.
lngStatus = CommSetLine(intPortID, LINE_RTS, True)
lngStatus = CommSetLine(intPortID, LINE_DTR, True)
Call CmdCwrite_Click
Call SleepTest
Call CmdCread_Click
Call CmdClose_Click
Me.CboEsdInvoices.Requery
Exit Sub

Open in new window

 
Do we need to amend it somehow?
 
Gadget Details from the supplier.
 
The gadget device provides ethernet port serial communication ports for data transmission.
The gadget provides two connection mode which are Ethernet and serial. For serial connection, two serial ports include (USB to TTL) and RS232 are supported. The POS system should set the right port for communication before transaction data transmission. For Ethernet connection, the gadget must get IP address by assistant tool which provide static IP and DHCP mode.
ASKER CERTIFIED SOLUTION
Avatar of ste5an
ste5an
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial