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

Navigation Buttons

Status
Not open for further replies.

yippiekyyay

Programmer
Oct 26, 2002
186
CA
Hello forum (again!),

I am trying to program my own navigation buttons but am having a bit of a problem! (which is strange because I am copying the example right out of my textbook except they are using the DataEnvironment and I am using ADO).

The code:
If frmForm.adoControl.Recordset.BOF = True Then
cmdPrevious.Enabled = False
End If

looks straight forward enough but it won't ever be true on the first record - instead, you can go back one more and get get a blank record (same is true for EOF - it's not true until after the last record).

Any ideas on what I could be doing wrong? I was thinkng of using the recordcount - but then wouldn't I end up with the same problem? I am also unsure of how to say "recordset.record(1)" (or something to that effect).

Thanks - any help would be greatly appreciated!!!

-Sean

 
Sean-

It's indeed the correct behavior for BOF to not be TRUE until you hit the "before-the-first" record. Therefore, if what you're trying to do is find out if you're on the first record, you're gonna have to scan back a record and see if that's BOF, and if so, then disable the Previous button.

If you're getting your example out of Deitel, you'll notice that their example actually exhibits the same behavior (ie, you can still hit Previous when looking at the first record).

Hope that helps,
ed
[afro]
 
Thanks cacaman - it was the Deital example too! (I was wondering what I was doing wrong...)

-Sean
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top