Disable these buttons ! ! !

M

Mario

I've added some buttons to my application. They are allowing to move between
records. (goto first record, goto previous, next and last record)

How do you disable the first two buttons when you're on 1st record,
and the last two when you're on the last record?

Can you write this code in Visual Basic, and not using macros?

Thanks!
 
C

Cheryl Fischer

Here is some code that can go in your form's Current event. The code is
for the cmdPrevious and cmdNext buttons - just dupe the appropriate lines
(and change control names) to enable/disable the First Record and Last
Record buttons.

Me.RecordsetClone.MoveLast
cmdPrevious.Enabled = Not Me.CurrentRecord = 1
cmdNext.Enabled = Not Me.CurrentRecord = Me.RecordsetClone.RecordCount
 

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

Top