I have a form that displays search results. The user can click First, Next, Previous, and Last to go through the records. This works fine, and the correct data is shown in the correct order. I am having a problem with displaying the count of the current record in a "1 out of 6" format. Here is the background:
The form gets its data from PubMonthlyProgressRS, and always opens on the first record of that RS. There are fields at the top of the form arranged like this:
txtRecordCurrent "out of" txtRecordTotal
If the search only pulls up one record, the display is correct "1 out of 1". If there's > 1 record, the first number is always 2. If any button is clicked, it always changes to the max, and stays that way. For example, this is what's shown with a RS of 6 records:
2 out of 6 (with 1st record showing)
Click Next or Last
6 out of 6 (with Next/Last record showing)
Click First or Previous
6 out of 6 (with First /Previous record showing)
Here's the code I'm using (called each time a button is clicked):
Dim DummyRS As DAO.Recordset
Set DummyRS = PubMonthlyProgressRS.Clone
DummyRS.Bookmark = PubMonthlyProgressRS.Bookmark
txtRecordCurrent.Value = DummyRS.RecordCount
DummyRS.MoveLast
txtRecordTotal.Value = DummyRS.RecordCount
DummyRS.Close
Can someone please tell me what I'm doing wrong?
Thanks,
Steve Geller
The form gets its data from PubMonthlyProgressRS, and always opens on the first record of that RS. There are fields at the top of the form arranged like this:
txtRecordCurrent "out of" txtRecordTotal
If the search only pulls up one record, the display is correct "1 out of 1". If there's > 1 record, the first number is always 2. If any button is clicked, it always changes to the max, and stays that way. For example, this is what's shown with a RS of 6 records:
2 out of 6 (with 1st record showing)
Click Next or Last
6 out of 6 (with Next/Last record showing)
Click First or Previous
6 out of 6 (with First /Previous record showing)
Here's the code I'm using (called each time a button is clicked):
Dim DummyRS As DAO.Recordset
Set DummyRS = PubMonthlyProgressRS.Clone
DummyRS.Bookmark = PubMonthlyProgressRS.Bookmark
txtRecordCurrent.Value = DummyRS.RecordCount
DummyRS.MoveLast
txtRecordTotal.Value = DummyRS.RecordCount
DummyRS.Close
Can someone please tell me what I'm doing wrong?
Thanks,
Steve Geller