Inteligent Nav buttons help

L

LJG

Hi Guys,

I am just adding some code to enable/disable nav buttons and am getting a
run time 13 Type Mismatch error on line

Set recClone = Me.RecordsetClone()

The form that is using this displays a number of current customer records
and want to scroll through without errors, anyone help with this please?

TIA

Code below:

Private Sub Form_Current()
Dim recClone As Recordset
Dim intNewRecord As Integer
'Make a clone of the recordset underlying the form so
'we can move around without getting error's
Set recClone = Me.RecordsetClone()

'If this is a new record then disable the <next> and <new> buttons
' and enable the others. then exit the procedure

intNewRecord = IsNull(Me.orderID)
If intNewRecord Then
cmdFirst.Enabled = True
cmdNext.Enabled = False
cmdPrev.Enabled = True
cmdLast.Enabled = True
Exit Sub

End If

If recClone.RecordCount = 0 Then
cmdFirst.Enabled = False
cmdNext.Enabled = False
cmdPrev.Enabled = False
cmdLast.Enabled = False

Else

'synchronise the current pointer in the two recordsets
recClone.Bookmark = Me.Bookmark

'If there are records, see if we are on the first record
'if so, we should disable the <first> and <pre> buttons

recClone.MovePrevious
cmdFirst.Enabled = Not (recClone.BOF)
cmdPrev.Enabled = Not (recClone.BOF)
recClone.MoveNext

'And then check whether we are on the last record
'if so, w should disable the <Last> and <Next> buttons

recClone.MoveNext
cmdLast.Enabled = Not (recClone.BOF)
cmdNext.Enabled = Not (recClone.BOF)
recClone.MovePrevious
End If

'and close cloned recordset
recClone.Close
End Sub
 
A

Amy Blankenship

Try dim recClone as DAO.Recordset
If that doesn't work, tri dim recClone as ADODB.Recordset
If all else fails, make it a variant.

HTH;

Amy
 
L

LJG

Cheers Amy, DAO did the job

Thanks
Les


Amy Blankenship said:
Try dim recClone as DAO.Recordset
If that doesn't work, tri dim recClone as ADODB.Recordset
If all else fails, make it a variant.

HTH;

Amy
 

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

Similar Threads


Top