Serial port

G

Guest

Does anybody have a clue how to setup communication with the serial port in
access
To send commands to the serial port and retreive data and store this in the
database?

A reference to a document would be very helpfull.

Thank you so much

Marcel
 
G

Guest

Hi,

I am using MSComm32.ocx to develop a Call Accounting Software, which
communicate with Pbx via Serial port. MsComm is ActiveX, it is easy to use.
You can search document for MsComm from Microsoft or VC++ 6.0 CD.

' Declare some contanst

'Constant of Handshaking
Const comNone = 0 ' No handshaking.
Const comXonXoff = 1 ' XOn/XOff
handshaking.
Const comRTS = 2 '
Request-to-send/clear-to-send handshaking.
Const comRTSXOnXOff = 3 ' Both
request-to-send and XOn/XOff handshaking.

'Constant of OnComm
Const comEvSend = 1 ' Send event.
Const comEvReceive = 2 ' Receive event.
Const comEvCTS = 3 ' Change in
clear-to-send line.
Const comEvDSR = 4 ' Change in data-set
ready line.
Const comEvCD = 5 ' Change in carrier
detect line.
Const comEvRing = 6 ' Ring detect.
Const comEvEOF = 7 ' End of file.

Function to initialize a Com port like below. I don't copy the code to get
parameter into variables:

' Set which serial port will be used
Me.msComm.CommPort = 1 ' 1 is COM 1, 2 is COM 2...

'Set communication parameter for that port
strPortSetting = strBaudRate & "," & Mid(strParityBit, 1, 1) & "," _
& strByteSize & "," & strStopBits

Me.msComm.Settings = strPortSetting

' Tell the control to read 1 byte
Me.msComm.InputLen = 0

' Set InputMode
Me.msComm.InputMode = 0 ' 0 input as text, 1 input as binary

' Causes the MSComm control to generate the OnComm event every time a
single character is placed in the receive buffer.
Me.msComm.RThreshold = 1

' Set HandShaking
Select Case strFlowControl
Case "None"
Me.msComm.Handshaking = comNone

Case "Hardware"
Me.msComm.Handshaking = comRTS

Case "Xon/Xoff"
Me.msComm.Handshaking = comXonXoff

Case "Xon/Xoff + Hardware"
Me.msComm.Handshaking = comRTSXOnXOff

End Select

' Open the port.
Me.msComm.PortOpen = True


When data coming, OnComm procedure will be called. Write some code like this
inside OnComm event-procedure:

if (Me.msComm.CommEvent = comEvReceive) then
' Get data
debug.print Me.msComm.Input

end if

Regards
Quang
 
G

Guest

Thank you Both for the help looks all very usefull

One question I have, when trying to include the MSCOMM i get the message it
is not licensed?

Does this not come standard with Access/Office/XP?

Or am i doing something stupid?

Thank you

marcel
 
G

Guest

When putting it on a form, it will ask for license if you copy that file from
other PC.

This component come with Visual Studio 6 CD. I remember that when installing
this CD, you can check to install only "ActiveX", no need to check to install
other applications, then licensed MsComm32.ocx will be installed.

You can go to google, search for Mscomm for further info

Regards
Quang
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top