Results 1 to 10 of 10
  1. #1
    Amras is offline Novice
    Windows 2K Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Sioux Falls, SD
    Posts
    29

    Set rs = Me.Recordset.Clone shuts Access 2013 down!

    Good afternoon and thank you for taking a moment to read my thread.

    I've got a multitude of legacy databases that were all created as Access 2003-2007 .mdb files. After having upgraded to Office 2010 a few years ago, the company is now upgrading to Office 2013, so now all of these applications are being dragged, kicking and screaming, into the modern world.

    One application, in particular, is giving me grey(er) hair. The user has a form where they'll enter an employee's LAN ID or name to access their record. The code below will populate the form:

    Code:
    Sub LoadEmployee(Senario As Integer)
    
    On Error GoTo errorone
    Dim Seach_Emp As Object
    Dim rsRecord As Object
    
    
    Select Case Senario
    Case 1
        Set Seach_Emp = CurrentDb.OpenRecordset("SELECT [Candidate Unique ID], Name, [LAN ID], [No call center experience], [Long commute], [Recently moved to community], [College commitments], [Other (please specify)], [Other explaination] FROM [Hire profile] WHERE [Candidate Unique ID]=" & [LAN ID lookup] & ";")
        [Name lookup] = Seach_Emp![Candidate Unique ID]
        Set rsRecord = Me.Recordset.Clone
        rsRecord.findfirst "[Candidate Unique ID] = " & [LAN ID lookup]
        If Not rsRecord.EOF Then Me.Bookmark = rsRecord.Bookmark
    Case 2
        Set Seach_Emp = CurrentDb.OpenRecordset("SELECT [Candidate Unique ID], Name, [LAN ID], [No call center experience], [Long commute], [Recently moved to community], [College commitments], [Other (please specify)], [Other explaination] FROM [Hire profile] WHERE [Candidate Unique ID]=" & [Name lookup] & ";")
        [LAN ID lookup] = Seach_Emp![Candidate Unique ID]
        Set rsRecord = Me.Recordset.Clone   'error here in Access 2013
        rsRecord.findfirst "[Candidate Unique ID] = " & [Name lookup]
        If Not rsRecord.EOF Then Me.Bookmark = rsRecord.Bookmark
    End Select
    
    
    Seach_Emp.Close
    
    
    errorone:
    
    
    Exit Sub
    
    
    End Sub
    The error occurs on line "Set rsRecord = Me. Recordset.Clone" in either Case 1 or Case 2; the error actually causes A2013 to crash.

    This code works flawlessly in A2010. This is only a problem with the few people who have A2013 instead. Eventually, everyone will be migrated to 2013, so remaining in the A2010 environment isn't possible.

    I have little experience with recordset clones and bookmarks, so hope that someone could shed some light on this issue. I hope I've explained my issue clearly enough. Thanks again for your time.

    Amras

  2. #2
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    If you compile the code (Debug, Compile) does it give an error? Maybe try changing rsRecord As Object to rsRecord As Recordset and see what happens.

  3. #3
    Amras is offline Novice
    Windows 2K Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Sioux Falls, SD
    Posts
    29
    Thanks for the suggestion, Bulzie, but I'm still getting the same crash message "Microsoft Access has stopped working..." The database still works perfectly in 2010, but crashes in 2013.

  4. #4
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    I agree that the

    Dim rsRecord As Object

    may need to be changed to

    Dim rsRecord As Recordset

    and may even need to be changed to

    Dim rsRecord As DAO.Recordset

    I seem to remember that the need to be more explicit has evolved as the post-2003 versions have increased.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Amras is offline Novice
    Windows 2K Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Sioux Falls, SD
    Posts
    29
    Thank you for chiming in, Missinglinq, but your suggestion didn't correct the error. The database still works in A2010, but still crashes in A2013.

  6. #6
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    Can you get to the code screen to run a compile(Debug, Compile)? If so does it give an error or no? Might be a missing Reference file?

  7. #7
    Amras is offline Novice
    Windows 2K Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Sioux Falls, SD
    Posts
    29
    I apologize for missing your question, Bulzie. I decompiled/recompiled. No errors there.

  8. #8
    Bulzie is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    Nov 2015
    Posts
    1,471
    Can you change that part to a select statement or a query instead of RecordsetClone method?

    Set rsRecord = "Select * from Table..."

  9. #9
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Are you sure this is correct : Set rsRecord = Me.Recordset.Clone ?

    In Access 2010 this should be Set rsRecord = Me.RecordsetClone - no period between Recordset and Clone

    Try that and see if it works.

  10. #10
    Amras is offline Novice
    Windows 2K Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Sioux Falls, SD
    Posts
    29
    John_G, you nailed it! Thanks so very much for your direction. This is a legacy database that worked perfectly in prior versions of Access, but didn't play well with 2013! Such a minor matter to make a huge difference, but that was it. 'preciate your help, all.

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

Similar Threads

  1. recordset clone and search
    By Sweetu in forum Forms
    Replies: 5
    Last Post: 12-09-2016, 04:33 AM
  2. recordset clone method
    By vientito in forum Programming
    Replies: 1
    Last Post: 10-30-2014, 11:33 PM
  3. Output form recordset clone to word
    By silverspr in forum Programming
    Replies: 1
    Last Post: 02-07-2013, 01:32 PM
  4. RecordSet Clone Problem with code
    By rlsublime in forum Programming
    Replies: 8
    Last Post: 06-21-2012, 11:56 AM
  5. multiple combo boxes recordset clone
    By trigirl67 in forum Forms
    Replies: 1
    Last Post: 01-30-2012, 02:32 PM

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