Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Unanswered: DAO & ADO Ref problem-FED UP-Help please

    I have used DAO in my code as follows:

    Dim db As DAO.Database
    Dim rst1 As DAO.Recordset
    Dim fld As DAO.Field
    'Further code lines here..

    Which works fine.

    I then used ADO in VBA in same db as follows:

    Private Sub P_UpDate(ByVal Tnm As String, _
    ByVal TotRct As Long, ByVal Cdn As String)
    Dim rst As ADODB.Recordset, Cnt As Long, Rct As Long

    Set rst = New ADODB.Recordset
    Set rst.ActiveConnection = CurrentProject.Connection
    rst.CursorType = adOpenKeyset
    rst.CursorLocation = adUseClient
    'Some more code lines here.
    End Sub.

    When compiles, it produces error as follows:

    Compile error.

    User-defined type not defined

    To come over this I set the library file from Reference in VBA (Pic attached for ready reference). Also I moved refences ups and downs to change the order to avoid the error. But error still persist.

    I am fed up of this error. Can somebody of you help me to solve this issue ?

    ADO was working since long but latestly I used DAO also for a specific task and since then it started to produce error.

    One more thing. The Private sub of ADO is for a particular Form which is not presently I kept in the db. DO YOU THINK THAT BECAUSE FORM IS NOT INCLUDED IN THE DB AND ITS CODE IS STILL REMAIN IN VBA HENCE IT PRODUCES ERROR ? Or what exactly I should take action to avoid this error ?

    Hope somebody will help me solve this problem.

    With kind regards,
    Ashfaque
    Attached Thumbnails Attached Thumbnails DAO AND ADODB REF ERROR.JPG  

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi Ashfaque

    You've referenced just about every ADO file but the correct one. You want to select "Microsoft ActiveX Data Objects 2.x Library" (Note - no mention of recordset).

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Lovely....

    Thanks a lot again Pootle for your valuable reply.

    It compliled code successfully....

    Again thanks.

    With kind regards,
    Ashfaque

Posting Permissions

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