[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 297
  • Last Modified:

MSCOMM and Access 2000

I am having a problem.  I am trying to use MSCOMM to connect and read from a serial port but my program won't run because of the following error.

**************************************
Runtime Error '91'.

Object Variable or With Block Variable not Set
**************************************

Here's my code:

If tglPortStatus.Caption = "Port Closed" Then
        Dim msComm1 As MSComm
        Dim i As Integer
     
        ' Set MSComm = New MSComm
        ' Buffer to hold input string
        Dim Instring As String
        ' Use COM1.
        With msComm1
            .CommPort = 1
            ' 9600 baud, no parity, 8 data, and 1 stop bit.
            .Settings = "9600,N,8,1"
            ' Tell the control to read entire buffer when Input
            ' is used.
            .InputLen = 0
            ' Open the port.
            .PortOpen = True
        End With
        ' Wait for data to come back to the serial port.
        Do
           DoEvents
           Buffer$ = Buffer$ & msComm1.Input
           MsgBox Buffer$
        Loop Until txtReading1.Text <> "" Or Not IsNull(txtReading1)
        ' Close the serial port.
        msComm1.PortOpen = False
        Set msComm1 = Nothing
    End If
0
ltrain2015
Asked:
ltrain2015
  • 6
  • 6
1 Solution
 
flavoCommented:
You'll need to uncomment

' Set MSComm = New MSComm

and replace it with

Set msComm1 = New MSComm

Idea?

Dave :-)
0
 
ltrain2015Author Commented:
OK,

When I try that I get:

*****************************
Run-time Error '429'

ActiveX component can't create object
*****************************

Any other suggestions?
0
 
flavoCommented:
Hmm... I got it working...

I think that error is because its not registered...

Try regeristing the OXC using regsvr32

Open the DOS prompt (type cmd in the Run under the start menu)

Type
cd\
regsvr32 c:\pathToControlFile\file.ocx


Dave
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
ltrain2015Author Commented:
I am having problems with licensing for the mscomm control.  is there anyway to get around it?

Letron
0
 
flavoCommented:
Do you have admin rights on your PC?
0
 
ltrain2015Author Commented:
Yes, I have domain admin rights.

I tried to add the MSCOM control a different way.

I opened a form in Access 2003 and tried to add the Microsoft Communications Control from the toolbox.  When I did that, it gave me the following message:

***************************************************************************************
You don't have the license required to use the ActiveX control.

You tried to open a form contatining an OLE object or an ActiveX control or you tried to create an ActiveX control.

To obtain the appropriate license, contact the company that provies the licensed OLE object or ActiveX control.
***************************************************************************************

How do I even go about licensing?  Or is there a back door around it?
0
 
flavoCommented:
Im not too sure?  Maybe my copy came from installing VB 6.0?
0
 
ltrain2015Author Commented:
You may be on to something.  I just grabbed VB6 from the software stash.  I am going to install it and see what happens.  I'll let you know.
0
 
ltrain2015Author Commented:
Ok, that worked.  I was able to put the control on my form.  So I guess VB6 licenses the control for you.  So if I wanted to run my access app on another pc, would I need to create an app package which includes my access file.  Would the installation correctly register the mscomm control?
0
 
flavoCommented:
You could create a REALLY simple VB app that has a reference to the OCX file, then create a setup package for that and run that first... that's the easy way i do
0
 
ltrain2015Author Commented:
thanks dude.  Looks like I'm in business.
0
 
flavoCommented:
woo! Finally got there :-)

Good luck with the rest of your project mate!

Dave
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now