title: Access 2010 compile error User-defined type not defined
body: <p>I converted a 2003 database to 2010 and VBA scripting created in 2003 is not working in 2010.  I am getting the message that there is a Complie Error - User-defined type not defined.  I do not have experience with VBA scripting and I did not create the script but understand that action that it is completing within the database.  The specific item it highlights is the DIM adoConn As New ADODB.Connection. </p>
  
  <p>I am including the script any assistance will be beneficial as the action that is performed is a great asset to our workflow.</p>
  
  <pre><code>Private Sub Error_code_exit(Cancel As Integer)
  
      On Error GoTo Error_code_exit
  
      Dim strSQLErrorCode As String
      Dim adoConn As New ADODB.Connection
      Dim adoRSErrorCode As New ADODB.Recordset
  
      Set adoConn = CurrentProject.Connection
  
      strSQLErrorCode = "SELECT [Error Matrix1].[Error Code], [Error Matrix1].CTC FROM [Error Matrix1];"
  
      adoRSErrorCode.Open strSQLErrorCode, adoConn, adOpenKeyset, adLockOptimistic
  
      If Not adoRSErrorCode.EOF Then
  
          Do
  
              If adoRSErrorCode.Fields("Error Code") = Me.Error_Code.Value Then
                  If IsNull(adoRSErrorCode.Fields("CTC")) Then
                      Me.chkAgree = True
                      Exit Do
                  End If
              End If
  
              adoRSErrorCode.MoveNext
  
          Loop Until adoRSErrorCode.EOF
  
      End If
  
      adoRSErrorCode.Close
      adoConn.Close
  
  Exit_code_exit:
      Exit Sub
  
  Error_code_exit:
  
      MsgBox Err.Description
      Resume Exit_code_exit
  
  
  End Sub
  </code></pre>