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
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