Finding the end of a recordset

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

Guest

I have two forms:
One is a pre-filter form for the other, it uses a list box to give the user the option to choose one, some, or all of the items to return. Once they choose, it sends over the recordsource for the next form so the user can add input to each record.

In the second form, the user can add info to three other fields, after they are finished, each record has a save or delete button afterwards. If they hit delete, it obviously deletes that record. If they hit save, it also obviously saves the record, then moves to the next record. My problem is when it tries to move to the next record when it is at the last record of the filter, it gives an error message that "You can't go to the specified record."

Can anyone help me on this one so it does not give that error? It also doesn't go through my BeforeUpdate for the form but only on the last record? Any help would be greatly appreciated. Thank you,
Steve
 
Hi,


That error is generally due to some invalid data in the record to be
saved (a required value that is not supplied, a reference that is not
matched, a condition impose on a field, etc.). You can try to enter a new
record, directly from the table view, with EXACTLY the same data you use in
the form, in hope to get a more descriptive source of the error.

You can't move to another record because the ACTUAL record is dirty and
need to be SAVED before moving OUT OF IT.


Hoping it may help,
Vanderghast, Access MVP

Steve said:
I have two forms:
One is a pre-filter form for the other, it uses a list box to give the
user the option to choose one, some, or all of the items to return. Once
they choose, it sends over the recordsource for the next form so the user
can add input to each record.
In the second form, the user can add info to three other fields, after
they are finished, each record has a save or delete button afterwards. If
they hit delete, it obviously deletes that record. If they hit save, it
also obviously saves the record, then moves to the next record. My problem
is when it tries to move to the next record when it is at the last record of
the filter, it gives an error message that "You can't go to the specified
record."
Can anyone help me on this one so it does not give that error? It also
doesn't go through my BeforeUpdate for the form but only on the last record?
Any help would be greatly appreciated. Thank you,
 
Hi,

You can test about the recordset EOF property, returning true if you
are at the end.


Me.RecordsetClone.Bookmark=Me.Bookmark
If Me.RecordsetClone.EOF then
...
End If



Hoping it may help,
Vanderghast, Access MVP


Steve said:
Thank you Michel,

Although, I know I need to save that last record but my code is set up to
save and then move to the next record. I would like to know if there was
code that checked if this was the last record and just saved it and not try
to move to the next record.
 
Back
Top