Results 1 to 4 of 4
  1. #1
    essaytee's Avatar
    essaytee is offline Been around a while
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2008
    Location
    Melbourne, Australia
    Posts
    27

    Compile error - Method or data member not found - (converting from 2003 to 2010)

    I'm in the process of converting an Access 2003 mdb to an Access 2010 (32 bit version). Needless to say, the Access 2003 version (mdb & mde) have been working flawlessly for close to ten years.



    I'm trying to convert the 2003 mdb file to Access 2010 32 bit version (accdb) file.

    I'm getting compile errors (Method or data member not found). The debug points to the dot operators of recordset objects as being the offending piece of code. Sample code here: Offending error line is pRst_Data.Edit
    Code:
    Function IsLocked(pRst_Data As Recordset, pStr_UserName As String, pStr_MachineName As String) As Boolean
    ' Purpose: determines if the current record in the recordset is locked,
    '          and if so who has it locked
    ' Returns: True if current record is locked (and sets pStr_UserName and pStr_MachineName
    '          to the user with the lock).  False if the record isn't locked.
    ' From: Building Applications Chapter 12
        
        Dim ErrorString As String
        Dim intMachineNameStart As Integer
        
        IsLocked = False
        On Error GoTo IsLockedError
        pRst_Data.Edit                     'Try to edit the current record in the recordset.
        pRst_Data.MoveNext
        pRst_Data.MovePrevious
        Exit Function               'No error, so return False.
    
    
    IsLockedError:
        If Err = 3260 Then          'Record is locked -- parse error string.
            ErrorString = Error$
            pStr_UserName = Mid$(ErrorString, 44, InStr(44, ErrorString, "'") - 44)
            intMachineNameStart = InStr(43, ErrorString, " on machine ") + 13
            pStr_MachineName = Mid$(ErrorString, intMachineNameStart, Len(ErrorString) - intMachineNameStart - 1)
            IsLocked = True
        End If
        Exit Function
    End Function
    The above is just one sample of obviously many that are strewn throughout my application. As mentioned, coding is correct under the 2003 version.

    I'm unsure of which references are suppose to be included but here is the list as it stands now (Access 2010 version):

    • Visual Basic For Applications
    • Microsoft Access 14.0 Object Library
    • OLE Automation
    • Microsoft Visual Basic for Applications Extensibility 5.3
    • Microsoft Office 14.0 Access database engine Object Library


    The references included for the Access 2003 version are as follows:
    • Visual Basic For Applications
    • Microsoft Access 10.0 Object Library
    • Microsoft DAO 3.6 Object Library
    • OLE Automation
    • Microsoft Visual Basic for Applications Exensibility 5.3
    • Microsoft ActiveX Data Objects 2.1 Library


    I've attempted to include the "Microsoft DAO 3.6 Object Library" into the 2010 version but I'm then hit with a name conflict error.

    Any advice or suggestions would be greatly appreciated in order to convert my application.

    Steve.

  2. #2
    essaytee's Avatar
    essaytee is offline Been around a while
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2008
    Location
    Melbourne, Australia
    Posts
    27
    Further, it appears that if I choose to keep my Access 2003 mdb compatible with Access 2002-2003 (Within Access 2010 32 bit version environment) the database works, all the code works.

    Surely though, it is possible to convert 2003 DAO code to 2010 code.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Try including:
    Microsoft Office 14.0 Object Library
    Microsoft ActiveX Data Objects 2.8 Library
    Microsoft ActiveX Data Objects Recordset 2.8 Library

    Shouldn't have to declare the DAO library.

    Think at one time I did have code to pass a recordset object to a procedure by argument but changed it to a public declared object in module header.

    Might want to declare the type of recordset - DAO or ADO depending on how you set and use the recordset object. Maybe these will be of interest:
    http://allenbrowne.com/ser-29.html
    http://allenbrowne.com/func-ado.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    essaytee's Avatar
    essaytee is offline Been around a while
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2008
    Location
    Melbourne, Australia
    Posts
    27
    Quote Originally Posted by June7 View Post
    Try including:
    ... snip
    Microsoft ActiveX Data Objects 2.8 Library
    Microsoft ActiveX Data Objects Recordset 2.8 Library
    Thanks, this did the trick. I can now compile the code and no errors returning. Probably not out of the woods yet but it's a start with the conversion.

    Quote Originally Posted by June7 View Post
    Shouldn't have to declare the DAO library.

    Think at one time I did have code to pass a recordset object to a procedure by argument but changed it to a public declared object in module header.

    Might want to declare the type of recordset - DAO or ADO depending on how you set and use the recordset object. Maybe these will be of interest:
    http://allenbrowne.com/ser-29.html
    http://allenbrowne.com/func-ado.html
    Interesting information. Seems like a simple global replace should do the trick re - the DAO thing.

    Steve.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Method or Data member not found error
    By junwatts in forum Access
    Replies: 1
    Last Post: 09-27-2013, 08:49 AM
  2. compile error method or data member not found???
    By chuman vishal in forum Programming
    Replies: 2
    Last Post: 02-26-2013, 01:57 PM
  3. Compiler error: Method or member not found
    By JosmithTwo in forum Programming
    Replies: 3
    Last Post: 11-26-2012, 07:10 AM
  4. Replies: 7
    Last Post: 06-08-2012, 09:55 PM
  5. Compile Error: Method or data member not found
    By subtilty in forum Programming
    Replies: 5
    Last Post: 02-09-2012, 07:56 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums