Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Syntax for testing EOF for a form's recordsource 2

Status
Not open for further replies.

stable

Programmer
Joined
Mar 19, 2003
Messages
92
Location
NZ
Hi there,

In my form I am not using the navigation buttons. Instead I've got my own buttons. For navigating to the next record in vba I use:
DoCmd.GoToRecord , , acNext

I have an ON Current event on my form to load values into unbound text boxes. However I need to detect EOF before the oncurrent event.

Does anyone know the syntax for this??

Cheers
Stable
 
Hi

Assuming it is possible to add records using your form, doing DoCmd.GoToRecord , , acNext on the last record will bring you to the 'new' record, so code like

DoCmd.GoToRecord , , acNext
If Me.NewRecord Then
DoCmd.GoToRecord , , acLast
End if

will stop you 'falling off the end'

also you could test the recordsetclone so

Me.recordsetClone.bookmark = me.bookmark
if me.recordsetclone.eof then
..whatever
end if

hope that helps

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Hi!

To avoid the on current firing off, one could try testin before attempting to move to the next record, for instance:

[tt]if me.currentrecord>=me.recordsetclone.recordcount then
msgbox "Already at last record"
else
docmd.gotorecord,,acnext
end if[/tt]

or use the .absoluteposition:

[tt]if me.recordset.absoluteposition+1= _
me.recordsetclone.recordcount then
msgbox "Already at last record"
else
docmd.gotorecord,,acnext
end if[/tt]

Roy-Vidar
 
Hi there,

Ken, I do not allow addition of records in this form. I tried the second method and it did not recognise the EOF.

Roy-Vidar, the currentrecord method works well.

Thanks guys
Stable
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top