
Move next takes user to new record - not wanted
Assuming it's not enough just to set the form's AllowAdditions property to
False, you can probably use code like this:
'---- start of modified code ----
Function MoveNextRecord()
Dim frm As Form
Set frm = Screen.ActiveForm
With frm
If .CurrentRecord < .RecordsetClone.RecordCount Then
DoCmd.GoToRecord , , acNext
End If
End With
Set frm = Nothing
End Function
'---- end of modified code ----
I changed the function name so as to avoid possible confusion with the
MoveNext method.
--
Dirk Goldgar
(remove NOSPAM from reply address)
Quote:
> Hi,
> I have put a button on a custom toolbar for move next and move previous,
but
> the move next allows the user to go past the last record onto a new
record -
> which I don't want.
> I need a function that prevents this. Had a go, but it doesn't seem to
> work - can anyone tell me where I'm going wrong?
> Cheers
> Paul
> Function movenext()
> Dim frm As Form, rst As Recordset
> Set frm = Screen.ActiveForm
> Set rst = frm.RecordsetClone
> If Not rst.EOF Then
> DoCmd.GoToRecord , , acNext
> End If
> End function