Share via

Access 2016 Recordset clone problem

Anonymous
2016-06-16T20:19:27+00:00

Having problem with Access 2016 with code that runs just fine in Access 2013.  I am trying to set a recordset clone:

Public Sub cmdReport_Click()

    On Error GoTo cmdReport_Click_Err

    Dim strFields As String

    Dim strWhere As String

    Dim strFrom As String

    Dim strOrderBy As String

    Dim strGroupBy As String

    Dim booTotals As Boolean

    Dim strQueryName As String

    Dim qdUserQuery As DAO.QueryDef

    Dim Rs As DAO.Recordset

    Dim Db As DAO.Database

    Dim i As Integer

    Dim strSQL  As String

Stop

    Me![sfrmQBFFields].Form.Requery

Stop

    Set Rs = Me![sfrmQBFFields].Form.RecordsetClone

Stop

    Rs.MoveLast

    i = Rs.RecordCount

    Rs.MoveFirst

Stop

Processing hangs when executing the statement:

           Set Rs = Me![sfrmQBFFields].Form.RecordsetClone

the application hangs and I have to cancel with Task Manager

Rs has been defined.

sfrmQBFFields is the name of the object containing the subform

my references include Microsoft DAO 3.6 object library

Suggestions?

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

8 answers

Sort by: Most helpful
  1. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2016-06-17T03:54:04+00:00

    If this crashes Access, you have SOME level of corruption going on. Use standard techniques to overcome it.

    You did already decompile, yes?

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2016-06-16T23:04:01+00:00

    Thanks Tom.

    Your slightly different syntax was no help.

    bob

    Was this answer helpful?

    0 comments No comments
  3. Tom van Stiphout 40,211 Reputation points MVP Volunteer Moderator
    2016-06-16T22:37:29+00:00

    .Clone is a different animal - see help file.

    The best syntax is:

    With Me.sfrmQBFFields.Form.RecordsetClone

      'do your thing

    End With

    Why "best"? Because you get automatic cleanup of the recordsetclone at the end of the With block.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2016-06-16T20:48:44+00:00

    Interesting idea.  Was not aware that the alternate syntax could be used.

    However, no joy.

    bob

    Was this answer helpful?

    0 comments No comments
  5. DBG 11,711 Reputation points Volunteer Moderator
    2016-06-16T20:27:54+00:00

    Hi. Not sure if it will make any difference but you could maybe try:

    Set Rs = Me![sfrmQBFFields].Form.Recordset.Clone

    Hope it helps...

    Was this answer helpful?

    0 comments No comments