Enable navigation buttons

  • Thread starter Thread starter Bruce
  • Start date Start date
B

Bruce

This is a partial repost with a different subject line, as
I received no reply to the previous question. Please
excuse the repetition, but I rarely receive a reply if I
do not hear within 24 hours.
I have a form (frmSession) to record a training session,
with fields for subject, instructor, etc. cmdPrevious and
cmdNext are navigation buttons on the form itself (rather
than at the bottom left corner). txtRecordCount is an
unbound text box to show the total number of records. The
form's On Open event includes the following (underscores
indicate no line break):

cmdPrevious.Enabled = Not Me.CurrentRecord = 1
cmdNext.Enabled = (Me.CurrentRecord = 1 And_
Me.Recordset.RecordCount > 1) Or Me.CurrentRecord <_
Me.Recordset.RecordCount
Me.txtRecordCount = Me.Recordset.RecordCount
Me.RecordSet.AddNew

The first two lines of code enable the navigation buttons
only when there are records. The third line of code is
intended to put the total number of records into
txtRecordCount. The fourth line opens the form at a
new record. The form opens with cmdPrevious enabled, and
cmdNext not enabled, just like with the built-in buttons
at the bottom of the form. txtRecordCount works as
expected.

To filter by [Subject], I select a value from a combo box
(cboLookupSubject) and apply the following to the combo
box's After Update event:
DoCmd.ApplyFilter, "[Subject]='" & cboLookupSubject_
& "'"

The After Update event also includes code similar to the
form's On Open event, but the navigation buttons are not
enabled and txtCounter is incorrect unless the code also
contains DoCmd.GoToRecord , , acLast, or until I move to
another record using the built-in navigation buttons at
the bottom of the form. The built-in navigation buttons
work as expected, as does the record counter. I would
like to have the navigation buttons I added to the form
work in the same way.
The other thing I would like to do with the counter is to
show 1 of 12, 2 of 12, etc. txtCounter shows the total,
but I don't know how to show the current (1, 2, etc.). I
know the built-in counter does this, but I would like it
to be right on the form, near the combo box.
 
Do you mean to tell me that it was that simple all along?
Thanks for the speedy reply, and for the very helpful link.
-----Original Message-----
Bruce

I think this covers everthing you need
http://www.applecore99.com/frm/frm014.asp
I have used this and it seems fine

regards

John

This is a partial repost with a different subject line, as
I received no reply to the previous question. Please
excuse the repetition, but I rarely receive a reply if I
do not hear within 24 hours.
I have a form (frmSession) to record a training session,
with fields for subject, instructor, etc. cmdPrevious and
cmdNext are navigation buttons on the form itself (rather
than at the bottom left corner). txtRecordCount is an
unbound text box to show the total number of records. The
form's On Open event includes the following (underscores
indicate no line break):

cmdPrevious.Enabled = Not Me.CurrentRecord = 1
cmdNext.Enabled = (Me.CurrentRecord = 1 And_
Me.Recordset.RecordCount > 1) Or Me.CurrentRecord <_
Me.Recordset.RecordCount
Me.txtRecordCount = Me.Recordset.RecordCount
Me.RecordSet.AddNew

The first two lines of code enable the navigation buttons
only when there are records. The third line of code is
intended to put the total number of records into
txtRecordCount. The fourth line opens the form at a
new record. The form opens with cmdPrevious enabled, and
cmdNext not enabled, just like with the built-in buttons
at the bottom of the form. txtRecordCount works as
expected.

To filter by [Subject], I select a value from a combo box
(cboLookupSubject) and apply the following to the combo
box's After Update event:
DoCmd.ApplyFilter, "[Subject]='" & cboLookupSubject_
& "'"

The After Update event also includes code similar to the
form's On Open event, but the navigation buttons are not
enabled and txtCounter is incorrect unless the code also
contains DoCmd.GoToRecord , , acLast, or until I move to
another record using the built-in navigation buttons at
the bottom of the form. The built-in navigation buttons
work as expected, as does the record counter. I would
like to have the navigation buttons I added to the form
work in the same way.
The other thing I would like to do with the counter is to
show 1 of 12, 2 of 12, etc. txtCounter shows the total,
but I don't know how to show the current (1, 2, etc.). I
know the built-in counter does this, but I would like it
to be right on the form, near the combo box.


.
 
Dear Bruce:

You might also want to take a look the following:

http://www.lebans.com/recnavbuttons.htm

HTH
Fred Boer


Bruce said:
Do you mean to tell me that it was that simple all along?
Thanks for the speedy reply, and for the very helpful link.
-----Original Message-----
Bruce

I think this covers everthing you need
http://www.applecore99.com/frm/frm014.asp
I have used this and it seems fine

regards

John

This is a partial repost with a different subject line, as
I received no reply to the previous question. Please
excuse the repetition, but I rarely receive a reply if I
do not hear within 24 hours.
I have a form (frmSession) to record a training session,
with fields for subject, instructor, etc. cmdPrevious and
cmdNext are navigation buttons on the form itself (rather
than at the bottom left corner). txtRecordCount is an
unbound text box to show the total number of records. The
form's On Open event includes the following (underscores
indicate no line break):

cmdPrevious.Enabled = Not Me.CurrentRecord = 1
cmdNext.Enabled = (Me.CurrentRecord = 1 And_
Me.Recordset.RecordCount > 1) Or Me.CurrentRecord <_
Me.Recordset.RecordCount
Me.txtRecordCount = Me.Recordset.RecordCount
Me.RecordSet.AddNew

The first two lines of code enable the navigation buttons
only when there are records. The third line of code is
intended to put the total number of records into
txtRecordCount. The fourth line opens the form at a
new record. The form opens with cmdPrevious enabled, and
cmdNext not enabled, just like with the built-in buttons
at the bottom of the form. txtRecordCount works as
expected.

To filter by [Subject], I select a value from a combo box
(cboLookupSubject) and apply the following to the combo
box's After Update event:
DoCmd.ApplyFilter, "[Subject]='" & cboLookupSubject_
& "'"

The After Update event also includes code similar to the
form's On Open event, but the navigation buttons are not
enabled and txtCounter is incorrect unless the code also
contains DoCmd.GoToRecord , , acLast, or until I move to
another record using the built-in navigation buttons at
the bottom of the form. The built-in navigation buttons
work as expected, as does the record counter. I would
like to have the navigation buttons I added to the form
work in the same way.
The other thing I would like to do with the counter is to
show 1 of 12, 2 of 12, etc. txtCounter shows the total,
but I don't know how to show the current (1, 2, etc.). I
know the built-in counter does this, but I would like it
to be right on the form, near the combo box.


.
 
Thanks for the tip. I have been to Lebans' site before,
but I didn't notice that. I should check there and the
MVP site first when I have questions. I am intrigued by
the idea of using a subform for that purpose, though I
have to admit it is a bit difficult for me to follow,
particularly how the total number of records evidently
appears in a label.
-----Original Message-----
Dear Bruce:

You might also want to take a look the following:

http://www.lebans.com/recnavbuttons.htm

HTH
Fred Boer


Do you mean to tell me that it was that simple all along?
Thanks for the speedy reply, and for the very helpful link.
-----Original Message-----
Bruce

I think this covers everthing you need
http://www.applecore99.com/frm/frm014.asp
I have used this and it seems fine

regards

John

This is a partial repost with a different subject
line,
as
I received no reply to the previous question. Please
excuse the repetition, but I rarely receive a reply if I
do not hear within 24 hours.
I have a form (frmSession) to record a training session,
with fields for subject, instructor, etc.
cmdPrevious
and
cmdNext are navigation buttons on the form itself (rather
than at the bottom left corner). txtRecordCount is an
unbound text box to show the total number of records. The
form's On Open event includes the following (underscores
indicate no line break):

cmdPrevious.Enabled = Not Me.CurrentRecord = 1
cmdNext.Enabled = (Me.CurrentRecord = 1 And_
Me.Recordset.RecordCount > 1) Or
Me.CurrentRecord
<_
Me.Recordset.RecordCount
Me.txtRecordCount = Me.Recordset.RecordCount
Me.RecordSet.AddNew

The first two lines of code enable the navigation buttons
only when there are records. The third line of code is
intended to put the total number of records into
txtRecordCount. The fourth line opens the form at a
new record. The form opens with cmdPrevious enabled, and
cmdNext not enabled, just like with the built-in buttons
at the bottom of the form. txtRecordCount works as
expected.

To filter by [Subject], I select a value from a combo box
(cboLookupSubject) and apply the following to the combo
box's After Update event:
DoCmd.ApplyFilter, "[Subject]='" & cboLookupSubject_
& "'"

The After Update event also includes code similar to the
form's On Open event, but the navigation buttons are not
enabled and txtCounter is incorrect unless the code also
contains DoCmd.GoToRecord , , acLast, or until I move to
another record using the built-in navigation buttons at
the bottom of the form. The built-in navigation buttons
work as expected, as does the record counter. I would
like to have the navigation buttons I added to the form
work in the same way.
The other thing I would like to do with the counter
is
to
show 1 of 12, 2 of 12, etc. txtCounter shows the total,
but I don't know how to show the current (1, 2,
etc.).
I
know the built-in counter does this, but I would like it
to be right on the form, near the combo box.



.


.
 
Back
Top