Results 1 to 6 of 6

Thread: detecting EOF/BOF

  1. #1
    nullus
    Guest

    detecting EOF/BOF

    i've made my own little kind of ADO data control with 2 buttons (previous & next) and a textbox to display the ID of the record. is there anyway i can detect if, when the user clicks Next and moves to another record, that the record following this record is the EOF marker, so that i can disable this button, and vice-versa for the Previous button? at the moment i'm using an error handler, so that when they hit the EOF marker, it drops in to the error handler and disables the button, but this seems like a pretty dodgy solution.

  2. #2
    Addicted Member morphman2000's Avatar
    Join Date
    Oct 2000
    Location
    Europe, The Netherlands
    Posts
    254
    Suppose 'Rs' is our RecordSet.

    Code:
    if Rs.EOF = True then
      msgbox("You reached EOF!"),vbinformation
    end if
    same for previous:

    Code:
    if Rs.BOF = True then
      msgbox("You reached BOF!"),vbinformation
    end if

  3. #3
    nullus
    Guest
    thanks, but that's not quite what i need. i found another way of doing what i have already, by using AbsolutePosition, but i need to know if the record they're currently on is the one just before the EOF marker, rather than knowing if they've just reached the EOF marker.

  4. #4
    Frenzied Member Jotaf98's Avatar
    Join Date
    Jun 2000
    Location
    I'm not gonna give you my IP address! Ok... Portugal, South-Western Europe, 3rd rock from the sun (our star is easy to find, a 47 Ursae Majoris in the Milky Way :p )
    Posts
    1,457
    That's easy: when you press "Next", instead of moving one position, move TWO positions. If the current record says "EOF", move back one position and disable the "Next" button. If it doesn't, move back one position and enable the "Next" button. It's that easy
    Code:
    Temp = Me.GetIQ()
    'Error 9: Overflow
    'DON'T PANIC! :eek:

    To learn how to use realistic effects in your games like fire, rain, snow and magic effects, read my article on particles systems here.


    Jotaf's Theories!
    "Cats land on their feet. Toast lands peanut butter side down. A cat with toast strapped to its back will hover above the ground in a state of quantum indecision."

  5. #5
    nullus
    Guest
    good idea although that may slows things up a bit, and it's already running fairly slow. i might just stick with disabling it when they reach EOF. thanks for the suggestions though

  6. #6
    _______ HeSaidJoe's Avatar
    Join Date
    Jun 1999
    Location
    Canada
    Posts
    3,946

    <?>

    Code:
    Private Sub checkbtns()
        '
        ' Check for button positions
        '
            rs.MovePrevious
            cmdPrevious.Enabled = Not (rs.BOF)
            rs.MoveNext
        '
            rs.MoveNext
            cmdNext.Enabled = Not (rs.EOF)
            rs.MovePrevious
        '
        End Sub
    "A myth is not the succession of individual images,
    but an integerated meaningful entity,
    reflecting a distinct aspect of the real world."

    ___ Adolf Jensen

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width