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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EOF error, error???... 1

Status
Not open for further replies.

RealKiwi

Technical User
Feb 26, 2004
41
NZ
I have a form with a table recordsource and two comboboxes: cboCompany and cboOrder. When the user "tabs" through the records, I update appearance of the combo boxs as the records change, with code in the Form_Current event.
Unfortunately I get "No current record" error immediately after tabbing from the last record. Why is this? I am exiting my sub if EOF/BOF are trapped.

thanks, as always
RK
 
G'Day RealKiwi,
I'm guessing it's because after tabbing from the last field in the form, the Form attempts to go to a New record (possible if you've got the Cycle property set to All Records). If you are using the form's Bookmark then it will also give an error.

You could either set the Cycle property to Current Page or Current Record to fix it, or put another error trap somewhere in your code (which you haven't given us).
Cheers mate!
 
Yeh, well g'day there too Edski.

Here's my dirty rotten code:

Dim rs as Recordset
Set rs = Me.RecordsetClone
If Not rs.EOF Then
rs.Bookmark = Me.Bookmark
If Not rs.BOF Then
Me.cboCompany = rs![or_coid] ' sync Company
Me.cboOrder = rs![or_id] ' sync Order#
Me.Repaint
End If
End If
Set rs = Nothing

Nothing beats a Friday arvo, cos it's now beer o'clock.
cheers!
 
How are ya RealKiwi . . . .

BOF and EOF are specifically related to recordsets in VBA, and are record position indicators. They have nothing to do with a new record, which is what you need to detect. To detect a new record, use the NewRecord property as follows:

[
Code:
If Not Me.NewRecord Then
        .
        .
    Your Code
        .
        .
End If

TheAceMan [wiggle]

 
Thanks AceMan, I "think" I know what you mean about VBA...

It works and that's the main thing!

cheers mate
RK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top