Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Troubleshooting
Research
Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Passing type array event args

Avatar of Basicfarmer
BasicfarmerFlag for United States of America asked on
Visual Basic Classic
4 Comments1 Solution403 ViewsLast Modified:
Experts, I have an activeX.exe that is to keep tabs on the network status of several industrial inkjet printers on a network in a manufacturing environment. I have created a type and array of that type and I need to pass it to the client program in the arguments of an event. I keep getting an error stating "Type Mismatch: array of user defined type expected." Can you please show me what i am missing here. I am sure I have not delared something properly.

Below is some of my code. The error happens in the startComm procedure.

Private Type netComm

    ipAddress As String
    printerReady As Boolean
   
End Type

Private commStatus() As netComm

Public Sub startComm()

    Dim SQL As String, rs As DAO.Recordset, varLoop As Long
   
    printerCount = DCount("IPAddress", "Printers")

    'ReDim Preserve ipAddress(printerCount) As String
    'ReDim Preserve printerReady(printerCount) As Boolean
    ReDim tcp(printerCount) As tcp
    'ReDim Preserve printer(2, printerCount) As String
    ReDim commStatus(printerCount) As netComm
   
    SQL = "SELECT IPAddress FROM Printers"
    Set rs = currentDb.OpenRecordset(SQL)
   
    varLoop = 0
   
    Do While Not rs.EOF

        'printerReady(varLoop) = False
        'ipAddress(varLoop) = rs.Fields("IPAddress")
        'printer(0, varLoop) = rs.Fields("IPAddress")
        'printer(1, varLoop) = "Not Ready"
        commStatus(varLoop).ipAddress = rs.Fields("IPAddress")
        commStatus(varLoop).printerReady = False
       
        Set tcp(varLoop) = New tcp
       
        RaiseEvent onDisconnect(rs.Fields("IPAddress"))
       
        varLoop = varLoop + 1

        rs.MoveNext

    Loop
   
    rs.Close
    Set rs = Nothing
   
    RaiseEvent updateNet(commStatus())
   
    'commTimer.Enabled = True

End Sub
ASKER CERTIFIED SOLUTION
Avatar of nffvrxqgrcfqvvc
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answers