Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Stop the navigator button from moving beyond the last record

Status
Not open for further replies.

tothemax

MIS
Sep 27, 2001
15
US
Is there a way to allow the user to use the navigation buttons, but not allow them to move beyond the last record?
I have been trying to code it in VB but have not figured out a way to do this yet. Any help on this would be appreciated!!!
 
change the form's "Allow Additions" property (under the data tab) to False... Unless you are going to be adding records on this form.

PaulF
 
This is a bit more complex but greys out the button if you cant move
It involves 3 buttons New Next and Previos
Create the buttons as normal
Then the Code with your field and form names
!My stuffs in Blue
'======================================================================
'records movement buttons stuff
'-------------------------------------------------------------------------
Set recClone = Me.RecordsetClone()
blnNew = IsNull(Me!Stay_ID) 'If a new record then the next button is disabled
Me!Owner_ID.Value = Forms!owners2!Owner_ID.Value
CmdNext.Enabled = False
CmdPrevious.Enabled = True

End If

[CmdNew].Enabled = True

If recClone.RecordCount = 0 Then 'If there are no records then the next and previous buttons are disabled
CmdNext.Enabled = False
CmdPrevious.Enabled = False

Else
recClone.Bookmark = Me.Bookmark
recClone.MovePrevious
CmdPrevious.Enabled = Not (recClone.BOF) 'previous button disabled if first record
recClone.MoveNext 'Two move nexts, one to get back to current, one to go ahead.
recClone.MoveNext
CmdNext.Enabled = Not (recClone.EOF) 'next button disabled if last record
recClone.MovePrevious
End If

recClone.Close
RefreshDatabaseWindow

Copy and paste the above code into the OnCurrent event. Dont forget to change my field names with yours

Hope this helps
Hymn
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top