Navigation Button Settings and Coding Problem

E

Eka1618

Hello,

I have a form in which I have set the Navigation Button property to NO.

I have created my own buttons (btnPrevious and btnNext).

I have used the following Code in the form_Current Event:

btnPrevious.Enabled = Not Me.CurrentRecord = 1
btnNext.Enabled = Me.CurrentRecord < Me.Recordset.RecordCount

This has worked fine for months and now all of a sudden the code keeps both
buttons disabled unless I have set the Navigation Butons Property to YES.

I have tried re-creating the buttons, but no luck. I read that when the form
first loads that it displays the 1st record before the rest are loaded which
could explain my problem, however, I am not sure why this code is not working
correctly on some forms and not others...

If anyone has any suggestions on what I can do, please let me know.

Thank You!
 
E

Eka1618

I have tried the following code (which works):

If Me.CurrentRecord = 1 Then
btnPrevious.Enabled = False
btnNext.Enabled = True
ElseIf Me.CurrentRecord = Me.Recordset.RecordCount Then
btnPrevious.Enabled = True
btnNext.Enabled = False
End If

However, if the recordset count is 1 I want it to disable both buttons and
this code does not cover it. ( I have put an if statement in to do this, but
again the buttons will stay disabled.)

In other forms I use the following method:

If Me.Recordset.RecordCount = 1 Then
btnPrevious.Enabled = False
btnNext.Enabled = False
Else
btnPrevious.Enabled = Not Me.CurrentRecord = 1
btnNext.Enabled = Me.CurrentRecord < Me.Recordset.RecordCount
End If

Again, the code inside of here is always disabling them when it comes to the
4 subforms I am using at one point in my DB, that is why I have tried
changing it around.

I didn't mention before, but I am trying to use either of these methods for
the navigation button inside of subforms. It is only here in this one
particular area in which this code does not work. I have checked each subform
to make sure that it is enabled and I have check each button as
well...everything is Enabled.

If anyone has any suggestions on how I can solve this problem, please let me
know.

Thank You!
 

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

Similar Threads


Top