Configure Serial Port (1 Viewer)

wschian

Registered User.
Local time
Yesterday, 23:50
Joined
Dec 12, 2013
Messages
19
hello,
1)How to used VBA access code to configure the serial port? i want to set com3 2400,n,8,1

2)how to send the msg to pole display.:banghead::banghead::banghead:

TQ
I try to using this code, register mscomm32.ocx and enable "microsoft comm control 6.0 (SP6)" but still error. "Run time error 91, Object Variable or with block variable not set.

dim MSCOmm1 as mscomm
'Configure serial port
MSComm1.CommPort = 3
MSComm1.Settings = "2400,N,8,1"
MSComm1.PortOpen = True
 
Last edited:

wschian

Registered User.
Local time
Yesterday, 23:50
Joined
Dec 12, 2013
Messages
19
I found the answer.. share for all.
1)Download mscomm32.ocx and register it,
2)in regedit add the license key, [HKEY_CLASSES_ROOT\Licenses\4250E830-6AC2-11cf-8ADB-00AA00C00905]
@="kjljvjjjoquqmjjjvpqqkqmqykypoqjquoun"
3) enable "microsoft comm control 6.0 (SP6)"
4)write this code
Dim mscomm1 As New MSComm

mscomm1.CommPort = 1
mscomm1.Settings = "2400,N,8,1"
mscomm1.PortOpen = True

-----End
You can try to verify the port is sucessfull configure or not just type c:\mode in dos command
 

wschian

Registered User.
Local time
Yesterday, 23:50
Joined
Dec 12, 2013
Messages
19
i want to send this command([1BH][73H][31H]) to pole display. Below is my example , but difference thing are show in pole display. Anyone know how to correct it?

Dim mscomm1 As New MSComm
Dim msg as String

msg="[1BH][73H][31H]"

mscomm1.CommPort = 1
mscomm1.Settings = "2400,N,8,1"
mscomm1.PortOpen = True
mscomm1.Output = msg
 

wschian

Registered User.
Local time
Yesterday, 23:50
Joined
Dec 12, 2013
Messages
19
i found the way already and share to you all.

Dim mscomm1 As New MSComm
Dim msg As String

msg = Me.txt1 ' input txt
mscomm1.CommPort = 3 ' set port no
mscomm1.Settings = "2400,n,8,1" ' set parameter
mscomm1.PortOpen = True 'set port open
mscomm1.Output = Chr(27) & Chr(81) & Chr(65) & msg & Chr(13) ' display msg
mscomm1.PortOpen = False 'port close
 

Users who are viewing this thread

Top Bottom