I am getting the follwing error:

Compile Error:

User-defined type not defined

VB Code:
  1. Private Sub Go_search()
  2.    Dim sSQL As String
  3.    Dim cn As ADODB.Connection     <--- Error here
  4.    Dim rs As ADODB.Recordset
  5.    Dim Str As String, itmX As ListItem
  6.    
  7.    Set cn = New ADODB.Connection 'weve declared it as a ADODB connection lets set it.
  8.    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
  9.       "Data Source= " & App.Path & "\ADDBK.mdb" 'this is the connection string.
  10.    cn.Open
  11.    Set rs = New ADODB.Recordset
  12.    
  13.    sSQL = "SELECT Name, Phone, Keywords, Com_No "
  14.    sSQL = sSQL & "FROM Company "
  15.    
  16.    If Len(Text1(0).Text) > 0 Then
  17.       Str = "WHERE Keywords like %" & "'" & Text1(0).Text & "%'"
  18.    End If
  19.    
  20.    If Len(Text1(1).Text) > 0 Then
  21.       If Len(Str) = 0 Then
  22.          Str = "WHERE Name like " & "'" & Text1(1).Text & "%'"
  23.       Else
  24.          Str = Str & "AND Name like " & "'" & Text1(1).Text & "%'"
  25.       End If
  26.    End If
  27.      
  28.    sSQL = sSQL & Str
  29.    Set rs = cn.Execute(sSQL)
  30.    
  31.    Do Until rs.EOF = True
  32.       Set itmX = ADLV.ListItems.Add(, , rs.Fields("Name"))
  33.       itmX.SubItems(1) = rs.Fields("Phone")
  34.       itmX.SubItems(2) = rs.Fields("Keywords")
  35.       itmX.SubItems(3) = rs.Fields("COM_No")
  36.    
  37.       rs.MoveNext
  38.    Loop
  39.        
  40.    rs.Close
  41.    Set rs = Nothing
  42.    Set cn = Nothing
  43.        
  44.    ADLV.Sorted = True
  45.    ADLV.SortKey = 1
  46.    ADLV.SortOrder = lvwAscending
  47.    ADLV.Refresh
  48. End Sub