I am getting error "user defined type not defined" while compiling code in vb6 .the b

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ponnu123
    New Member
    • Sep 2012
    • 1

    I am getting error "user defined type not defined" while compiling code in vb6 .the b

    Code:
    FORM  SECTION
    
    Private Sub command1_click()
    tsql$ = "SELECT empname From employee"
    tsql$ = tsql$ & "where empid = 1 "
    Set rs = cn.Execute(tsql, openstatic, LockReadonly)
    While Not (rs.BOF Or rs.EOF)
    txtEmployeename.Text = rs(0)
    rs.MoveNext
    Wend
    
    
    End Sub
    
    Private Sub ee_DragDrop(Source As Control, X As Single, Y As Single)
    
    End Sub
    
    Private Sub Form_Load()
    datafile = "C:\database2.accdb"
    With cn
    .Provider = "microsoft.ACE.OLEDB.12.0"
    .ConnectionString = datafile
    .Open
    cboTask.Clear
    End With
    End Sub
       
    
    
    
    MODULE SECTION
    
    
    Global cn As New ADODB.Connection
    Global rs As New ADODB.Recordset
    Global datafile As String
    THe above code is for connecting to a database in access and to display the contents in it.
    When I compile the above code i am getting error message as "user defined type not defined".I have included
    Microsoft ADO EXT 2.8 for DDL and Security
    Microsoft DAO 3.6 Object library
    Last edited by zmbd; Sep 26 '12, 11:33 AM. Reason: When posting code, please format the code using the <CODE/> button.
  • MikeTheBike
    Recognized Expert Contributor
    • Jun 2007
    • 640

    #2
    Hi

    Just my two penney worth, shouldn't you have a reference to the Microsoft ActiveX Data Objct xxxx Library ??

    I don't think the ADO EXT DDL libary has Connection/Recordset objects. The the DAO 3.6 library does have, but that isn't ADO!!

    Don't know if that helps.

    MTB

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      It might help if you indicate which line reports the error.

      Comment

      • Stewart Ross
        Recognized Expert Moderator Specialist
        • Feb 2008
        • 2545

        #4
        MTB is right - you've included the wrong library. Look for one that is along the lines of

        Microsoft ActiveX Data Objects 2.1

        or whatever the latest version is that is available on your system.

        -Stewart

        Comment

        Working...