The string will be (for example) "ATDT3037571234"
Any assistance would be GREATLY appreciated.
Rick C
Your best bet would probably be an ActiveX control designed for this
purpose, but I'm not familiar with what's available. Tony Toews has a
page of links on his site, I believe; poke around at
http://www.granite.ab.ca/accsmstr.htm .
Failing that, I think you can open and write to the port directly as a
binary file using standard Basic I/O statements. You might try
something like this:
Dim intFileNo As Integer
intFileNo = FreeFile()
Open "COM3:" For Binary As #intFileNo
Put intFileNo, , "ATDT3037571234"
Close #intFileNo
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
You need to put an MSComm control on your form - from the list of ActiveX
controls, then set up its properties, and send it the string you need.
Something like:
If MSComm1.PortOpen = False Then
MSComm1.CommPort = "Com3"
MSComm1.Settings = "9600,n,8,1" 'adjust speed as appropriate
'most modern modems will auto-baud to whatever speed you set
MSComm1.Handshaking = comNone
MSComm1.SThreshold = 0
MSComm1.InputLen = 0
MSComm1.RThreshold = 1 'event on every input char
MSComm1.PortOpen = True
End If
MSComm1.Output = "ATDT3037571234" & vbCrLf
This example comes from VB5 - where there is a good help file on the use of
the control.
Its not simple to detect which port has a modem on it, but you could try
opening each port in turn, and sending just an "ATI" string. Most modems
will reply with at least an "ATI" and some sort of ID. Of course other
devices may also echo just the ATI, and you still dont know for sure you
have a modem.
--
Regards,
Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
"Dirk Goldgar" <d...@NOdataSPAMgnostics.com> wrote in message
news:OrBZjPe$CHA....@TK2MSFTNGP11.phx.gbl...
One thing you certainly can't do is *read* from a COM or LPT port as
if it were a file.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
"Adrian Jansen" <q...@noqqwhere.com> wrote in message
news:3e9350e7$1...@duster.adelaide.on.net...
> Put intFileNo, , "ATDT3037571234"
with this:
Put intFileNo, , "ATDT3037571234" & vbCrLf
or this
Print intFileNo, "ATDT3037571234"
If it turns out that this doesn't work, you might try the code posted
in MS Knowledgebase article 148857, "ACC: How to Dial a Phone Number
from MS Access 95/97":
http://support.microsoft.com/default.aspx?scid=kb;en-us;148857
Or, of course, use an ActiveX control.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)
"Dirk Goldgar" <d...@NOdataSPAMgnostics.com> wrote in message
news:OrBZjPe$CHA....@TK2MSFTNGP11.phx.gbl...
>
open "Com1:9600,n,8,1" for output as #1
print #1,"Test message" & vbcrlf
close #1
but it sent a pile of garbage, until I opened a standard comms package
Hyperteminal ), sent some strings, and then closed Hyperterm. After that I
could send from VBA. Presumably it doesnt fully set up the comms port.
I thought I tried this some time ago from VisualBasic5, and it didnt work at
all - just complained that you couldnt do that ( although on a different
machine running Win95 ) , but I just tried that too, and it works under
Win2000.
So yes, just open the port, get the settings correct, and print to it, works
like a charm !
Thanks Dirk for pointing this out, its certainly much easier for quick jobs
than the MSComm activeX control. Input may be a different story, altough I
might be temped just to try
Dim ln as string
LineInput #1,ln
to see what happens.
--
Regards,
Adrian Jansen
J & K MicroSystems
Microcomputer solutions for industrial control
"Dirk Goldgar" <d...@NOdataSPAMgnostics.com> wrote in message
news:eYxAJZr$CHA....@TK2MSFTNGP12.phx.gbl...
Well, thanks in return, Adrian, for saving me the trouble of checking
it out myself. I thought it would work, but you had made me
uncertain. I think I saw it used before for sending a BEL character
to open the till on a cash register.
> Input may be a different story, altough I
> might be temped just to try
>
> Dim ln as string
>
> LineInput #1,ln
>
> to see what happens.
Nahhh, it'll never work ... I don't think ... but try it and let us
know. :-)
> --
> Regards,
>
> Adrian Jansen
> J & K MicroSystems
> Microcomputer solutions for industrial control
And to you, Adrian.