Compile Error Open Connection

Posted on 2012-08-10
Last Modified: 2012-08-13
I am getting a compile error on this line.   " Dim cn As ABC.IOConnection"
"User defined type not defined"

I am thinking it is the references, but the Reference icon is not enabled when I try to open from this module.

When I look at the References from the form VBA they look like they have have all the References I need

Private Sub cmdIODialog_Click()
   Dim cn As ABC.IOConnection
    Set cn = New ABC.IOConnection
Question by:leezac
    LVL 65

    Expert Comment

    by:Jim Horn
    Define for us in great detail what ABC is.  By any chance do you mean ADO or ADODB?

    If you click on ABC and do a right-click:Definition and get a message box that says 'Identifier under cursor is not recognized', then Access doesn't know either.

    Author Comment

    ABC is a third party application where I am connecting to  to retrieve records into database using ADODB.  The code above is checking connection.
    LVL 65

    Expert Comment

    by:Jim Horn
    >When I look at the References from the form VBA they look like they have have all the References I need
    Okay, in that case...
    (1)  Just for kicks and giggles, make sure again that the Tools:References dialog has a line for whatever ABC is, and that it is checked.
    (2)  If the ABC .dll (.whatever) is on your local box, everything that ABC may reference also needs to be installed on your box.   If memory serves there is a Microsoft Dependancy Walker application that you can open, point to any .dll, and verify that everything that THAT .dll has as dependancies are all good.

    Author Comment

    Jim - it is not a dll.  I am not sure what it is as I inherited this code and am learning.  

    Here is how it is used elsewhere

    Public Sub Check_Connection()

        On Error GoTo Err_Check_Connection
        Set cn = CreateObject("ABC.IOConnection")
        cn.CommType = "IP"
        cn.HostIP = ""
        cn.Port = "0000"

        If IsNull(Forms!frmMain.txtIP) Or IsNull(Forms!frmMain.txtPort) Or IsNull(Forms!frmMain.txtUser) Or _
            (Forms!frmMain.txtIP <> cn.HostIP Or Forms!frmMain.txtPort <> cn.Port Or Forms!frmMain.txtUser <> cn.UserId) Then
            Dim d As Object
            Set d = CreateObject("ABC.IOConnection")
            If d.GetOk <> True Then
                Set d = Nothing
                Exit Sub
            End If
            Set d = Nothing
        End If
        With Forms!frmMain
            .txtCommType = cn.CommType
            .txtIP = cn.HostIP
            .txtPort = cn.Port
            .txtUser = cn.UserId
            .txtPassword = cn.Password
        End With
        Set cn = Nothing
        Set cn = CreateObject("ABC.IOConnection")
        cn.CommType = "IP"
        Exit Sub
    MsgBox Err.Description
    LVL 65

    Accepted Solution

    >Jim - it is not a dll.  I am not sure what it is
    Curiosity overwhelms me ...  Take a screen shot of your Tools:References dialog, and paste it as an image into this question.
    LVL 65

    Expert Comment

    by:Jim Horn
    Thanks for the grade, but did we get an answer?

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Suggested Solutions

    Title # Comments Views Activity
    Close form event - Type Mismatch 5 21
    Show Balance 3 15
    VBA/SQL - Connect to SQL server and pull data 4 38
    Subform Link field 13 20
    When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
    In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
    In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now