Recordset Clone "type mismatch"

  • Thread starter Thread starter robert
  • Start date Start date
R

robert

I have a form with command buttons (cmdFirst, cmdNext,
etc.), the OnCurrent property of the form is set to
=DisableEnable([Form]), when the form opens I am getting
an Error 13, type mismatch. I am not sure if it is
because of my reference settings or if I need to create a
connection. My code is as follows and I thank you in
advance for any assistance.

Public Function DisableEnable(frm As Form)
Dim rstClone As ADODB.Recordset
Set rstClone = frm.RecordsetClone
If frm.NewRecord Then
frm!cmdFirst.Enable = True
frm!cmdNext.Enabled = False
frm!cmdPrevious.Enabled = True
frm!cmdLast.Enabled = True
frm!cmdNew.Enabled = False
Exit Function
End If
frm!cmdNew.Enabled = True
If rstClone.RecordCount = 0 Then
frm!cmdFirst.Enable = False
frm!cmdNext.Enabled = False
frm!cmdPrevious.Enabled = False
frm!cmdLast.Enabled = False
Else
rstClone.Bookmark = frm.Bookmark
rstClone.MovePrevious
If rstClone.BOF Then
frm!cmdFirst.Enable = False
frm!cmdPrevious.Enabled = False
Else
frm!cmdFirst.Enabled = True
frm!cmdPrevious.Enabled = True
End If
rstClone.Bookmark = frm.Bookmark
rstClone.MoveNext
If rstClone.EOF Then
frm!cmdNext.Enabled = False
frm!cmdLast.Enabled = False
Else
frm!cmdNext.Enabled = True
frm!cmdLast.Enabled = True
End If
End If
End Function
 
I thought Form recordsets were always DAO recordsets.

Regards

Peter Russell
 
Any particular reason that you're using another object instead of just using
the RecordsetClone directly? Using it directly would avoid the entire
problem.

I believe that a form's recordset and recordsetclone are DAO recordsets;
however, it is possible to set a form's recordset to be equal to an ADO
recordset, although I haven't done that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top