Make a button active only when user is on last record or form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is it possible to know when the user is on the last record of the form and
only have a button active on that record and in active for all the other
records?

Thanks in advance
 
Try adding this the the Form_Current event.

You'll need to add your own command buttons, because I don't know if you can
make this code reference the record selectors on the forms and you'll have to
rename the 'FirstRecordButton' part to match your command button names.

--------------
Me.FirstRecordButton.Enabled = (Me.CurrentRecord > 1 )
Me.PreviousRecordButton.Enabled = (Me.CurrentRecord < 1)
Me.RecordsetClone.Movelast
Me.NextRecordButton.Enabled = (Me.CurrentRecord < _
Me.RecordsetClone.RecordCount)
Me.LastRecordButton.Enabled = (Me.CurrentRecord < _
Me.RecordsetClone.RecordCount)
 
Hi John

Put some code in your Form_Current event procedure to compare CurrentRecord
with RecordCount:

cmdMyButton.Enabled = Me.CurrentRecord < Me.Recordset.RecordCount
 
Back
Top