Results 1 to 4 of 4

Error message: "Compile error. User-defined type not defined"

Threaded View

  1. #1
    Registered User
    Join Date
    08-27-2007
    Posts
    48

    Error message: "Compile error. User-defined type not defined"

    Hi,
    I am trying to get an Excel sheet to read/write to an Access DB. My code starts as shown below.
    When running it, I get the error: "Compile error. User-defined type not defined" - it crashes on the "Dim cnn As ADODB.Connection" line. I also notice that while String and Integer are syntax highlighted in blue, Range, ADODB.Connection and ADODB.Recordset remain black. I am guessing that my VB doesn't know how to interpret the ADODB commands.
    In tools-references, Microsoft DAO 2.5/3.51 compatability library is selected.

    Any thoughts on how to solve this would be welcome.

    Lotte

    Private Sub Worksheet_Change(ByVal Target As Range)
            
        Dim DBFullName As String
        Dim TableName As String
        Dim TargetRange As Range
    
        
        Dim cnn As ADODB.Connection
        Dim rs As ADODB.Recordset
        Dim intColIndex As Integer
         
        DBFullName = "Qa.mdb"
        TableName = "Tasks"
        TargetRange = "A3"
    ...
    Last edited by dominicb; 09-18-2007 at 03:50 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1