Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Access - Serial Communications

68 views
Skip to first unread message

Diamond

unread,
Nov 21, 2001, 12:04:08 PM11/21/01
to
I'm trying to get phone Access 2000 database to communicate with a mobile
phone connected to the PC's serial port.

After researching this I found that MSCOMM32.OCX is the thing to use and
found some sample scripts.

I've made references to ths MSCOMM32.OCX files in Access but when I run the
module with the coding below all I get is a "Runtime error code 424"

I commented out some of the end statements just to see if the first few
commands would work but it falls over on the very first command:

MSComm1.CommPort = 2

I've looked on google and a number of site but can'r seem to find anything
other the references to Visual Basic - Do I need to have visual basic
installed to use the Serial Communication functions?


*** Below is the sample code ****

Sub PhoneTalk()


' Set up the communications port
MSComm1.CommPort = 2 ' Com Port 1

' Set for 9600 baud, no parity, 8 data, and 1 stop bit.
MSComm1.Settings = "9600,N,8,1"

' Tell the control to read entire buffer when Input is used
MSComm1.InputLen = 0

' Open the port
MSComm1.PortOpen = True

' Send an 'AT' command to the phone
MSComm1.Output = "AT" & Chr$(13) & Chr(10)
' The phone will respond with an 'OK'

' Set up the phone for a text message
MSComm1.Output = "AT+CMGF=1" & Chr$(13) & Chr(10)
' The phone will respond with an 'OK'

' Prep for SMS, give destination type and destination address.
' Enter the destination type and destination address to prep for SMS
' e.g. AT+CMGS="+2145551212",129
'MSComm1.Output = "AT+CMGS= " & Chr(34) & _
' "+2145551212" & Chr(34) & ",129" & Chr$(13) & Chr(10)
' The phone will return a'>' prompt, and await entry of the SMS message
text.

' Now send the text to the phone and terminate with (Ctrl-Z)
'MSComm1.Output = "This is a test. WOW! "
' The phone will respond with a conformation containing
' the 'message reference number' eg. +CMGS:

' Close the port
MSComm1.PortOpen = False
End Sub


Louis Laveaux

unread,
Nov 21, 2001, 3:32:28 PM11/21/01
to
Did you register the component?

regsrv32.exe complete_path/mscomm32.ocx

Louis
"Diamond" <diam...@fcukmail.com> schreef in bericht
news:b8RK7.1956$l42.3...@news11-gui.server.ntli.net...

Diamond

unread,
Nov 21, 2001, 4:17:45 PM11/21/01
to
I registered MSCOMM32 as per the instructions in the help file below, it
points to the file under the WinNT\System32 directory

----------------------------------------------------------------------------
--------------
Use this procedure to register an ActiveX control that isn't included with
Microsoft Access.
Add the files for the control to your hard disk. See the documentation that
came with the control for information.


On the Access Tools menu, click ActiveX Controls.


In the ActiveX Controls dialog box, click Register, specify a path to the
control in the Add ActiveX Control dialog box, and then click Open.


Click Close

"Louis Laveaux" <in...@laveaux.org> wrote in message
news:3bfc1093$0$1692@heracles...

Louis Laveaux

unread,
Nov 22, 2001, 3:55:25 PM11/22/01
to
Sorry that did not work.

Below is the code I used. This code works reading a barcode scanner. To be
able to use events, I had to create a classmodule. You dont need this when
transmitting via a modem. But you probably need to create the port with a
statement like

Dim Port as MSComm
Set Port = New MSComm

Louis

This is the code I used to activate and deactivate the commport.

Public WithEvents Port As MSComm

Private Sub Class_Initialize()
Set Port = New MSComm
Port.Settings = "9600,E,7,2"
Port.RThreshold = 1
Port.InBufferSize = 30
Port.InputLen = 1
Port.CommPort = 1
Port.PortOpen = True
MsgBox "Comm port activated. Settings: " & Port.Settings
End Sub

Private Sub Class_Terminate()
Port.PortOpen = False
End Sub

"Diamond" <diam...@fcukmail.com> schreef in bericht

news:_RUK7.5154$aW3.7...@news2-win.server.ntlworld.com...

0 new messages