End of record set error messages

MadCat

Registered User.
Local time
Today, 11:30
Joined
Jun 24, 2003
Messages
62
Hi all

I have a problem that i'm not quite sure how to sort. Initially when i started using Access, i had message boxes that would pop up when i was at the end of all records and there were no more in the direction i was going. These message boxes just let me click ok and then dissappeared. The problem is that now when i go of the end of the records i get an error

"Cannot go to specified record"

Only this time it gives me the option to end or debug. Does anyone know how i can resolve this to get the standard message back

Hopefully this makes sense

I should add that the buttons i am using are the ones created by a wizard. the nav buttons that are standard do not have this problem.

Thanks
 
Last edited:
This code in the On Current event of the form will hide the Next or Previous button when you reach the end of the recordset.

Dim recClone As DAO.Recordset

Set recClone = Me.RecordsetClone

If Me.NewRecord Then
Me.cmdNext.Enabled = False
Me.cmdBack.Enabled = False
Else
recClone.Bookmark = Me.Bookmark
recClone.MovePrevious
Me.cmdBack.Enabled = Not (recClone.BOF)
If recClone.BOF Then
Me.cmdBack.Visible = False
Else
Me.cmdBack.Visible = True
End If
recClone.MoveNext
recClone.MoveNext
Me.cmdNext.Enabled = Not (recClone.EOF)
If recClone.EOF Then
Me.cmdNext.Visible = False
Else
Me.cmdNext.Visible = True
End If
recClone.MovePrevious
End If

recClone.Close

Change cmdNext and cmdBack to the names of your command buttons.

hth,
Jack
 
Thank you!

Thats solved the problem.

Your help is much appreciated.
 
Jack - I had a similar problem. Thanks fopr your explanation; your solution is perfect!
 
Hello Jack,

This can serve in an application I have as well; however, I get the following error:

Compile Error:
User-defined type not defined

Access 2K highlights the following after Dim declariation:

recClone As DAO.Recordset

Any direction...
Jim

==========================
Disregard!
I checked my References and saw DAO was unchecked... :rolleyes:
All is working...
 
Last edited:
Bob and Jim -

I'm glad that both of you got your respective problems handled!

Jack
 

Users who are viewing this thread

Back
Top Bottom