Results 1 to 2 of 2

Thread: Mscomm

  1. #1
    Join Date
    May 2004

    Unanswered: Mscomm

    I have problem with getting activex contols properties to code section by writing code.I use Access2002.Altough I register ocx files related activex control result is same.For example

    Mscomm1.input ...tec.

    When I run it seems run but there is no result.

    Can you help me?

  2. #2
    Join Date
    Nov 2003
    As you already know the MSComm control is a serial communications control and it is important to ensure that the port being accessed is in fact available and functioning. If possible..find a loop-back routine to test the port so as to ensure things are working properly.

    This is not a loop-back routine (I would have to look through some of my old code for that) but it is a copy of a MS cummunications sample:

    'The following simple example shows basic serial communications using a modem:
    Private Sub Form_Load ()
    ' Buffer to hold input string
    Dim Instring As String
    ' Use COM1.
    MSComm1.CommPort = 1
    ' 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 the attention command to the modem.
    MSComm1.Output = "ATV1Q0" & Chr$(13) ' Ensure that 
    ' the modem responds with "OK".
    ' Wait for data to come back to the serial port.
    	 Buffer$ = Buffer$ & MSComm1.Input
    Loop Until InStr(Buffer$, "OK" & vbCRLF)
    ' Read the "OK" response data in the serial port.
    ' Close the serial port.
    MSComm1.PortOpen = False
    End Sub
    'Note The MSComm control can use polling or an event-driven method to
    'retrieve data from the port. This simple example uses the polling method. For
    'an example of the event-driven method, see help for the OnComm event.
    Although it's not a loop-back routine, it should put modem responses into your terminal window (provided you selected the COM port your modem is connected to. See modem properties).

    Last edited by CyberLynx; 05-13-04 at 03:12.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts