Grabbing the maximum value of a field's contents (but not in an Sql statement)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Chumley the Walrus

    Grabbing the maximum value of a field's contents (but not in an Sql statement)

    I need to evaluate a field's maximum value and then do an if
    conditional:


    if rs("havesubP") = true and rs("displaygrou p") < MAX then ....

    whereas MAX represents the biggest value in the records for the
    displaygroup field (an integer datatype). I get an "Either BOF or EOF
    is True, or the current record has been deleted.." error if i put any
    type of comparison number (of course MAX is not a vbscript keyword)
    that is larger than my largest displaygroup value in the dbase , as I
    will loop thru all the records once this condition is met.

    thanks
    chum
  • William Morris

    #2
    Re: Grabbing the maximum value of a field's contents (but not in an Sql statement)

    Toss the recordset into an array. You can loop through it as many times as
    you like then.

    - Wm

    --
    William Morris
    Product Development, Seritas LLC
    Kansas City, Missouri

    "Chumley the Walrus" <springb2k@yaho o.com> wrote in message
    news:1ef65641.0 403111136.108f4 8cd@posting.goo gle.com...[color=blue]
    > I need to evaluate a field's maximum value and then do an if
    > conditional:
    >
    >
    > if rs("havesubP") = true and rs("displaygrou p") < MAX then ....
    >
    > whereas MAX represents the biggest value in the records for the
    > displaygroup field (an integer datatype). I get an "Either BOF or EOF
    > is True, or the current record has been deleted.." error if i put any
    > type of comparison number (of course MAX is not a vbscript keyword)
    > that is larger than my largest displaygroup value in the dbase , as I
    > will loop thru all the records once this condition is met.
    >
    > thanks
    > chum[/color]


    Comment

    • Mark Schupp

      #3
      Re: Grabbing the maximum value of a field's contents (but not in an Sql statement)

      You need to check for eof in your loop. show the loop code.

      --
      Mark Schupp
      Head of Development
      Integrity eLearning



      "Chumley the Walrus" <springb2k@yaho o.com> wrote in message
      news:1ef65641.0 403111136.108f4 8cd@posting.goo gle.com...[color=blue]
      > I need to evaluate a field's maximum value and then do an if
      > conditional:
      >
      >
      > if rs("havesubP") = true and rs("displaygrou p") < MAX then ....
      >
      > whereas MAX represents the biggest value in the records for the
      > displaygroup field (an integer datatype). I get an "Either BOF or EOF
      > is True, or the current record has been deleted.." error if i put any
      > type of comparison number (of course MAX is not a vbscript keyword)
      > that is larger than my largest displaygroup value in the dbase , as I
      > will loop thru all the records once this condition is met.
      >
      > thanks
      > chum[/color]


      Comment

      • Chris Barber

        #4
        Re: Grabbing the maximum value of a field's contents (but not in an Sql statement)

        pobjRS.Sort = "[FIELD] DESC"
        pdblMaxValue = pobjRS.Fields(" FIELD").Value
        pobjRS.Sort = vbNullString

        Chris.


        "Chumley the Walrus" <springb2k@yaho o.com> wrote in message
        news:1ef65641.0 403111136.108f4 8cd@posting.goo gle.com...
        I need to evaluate a field's maximum value and then do an if
        conditional:


        if rs("havesubP") = true and rs("displaygrou p") < MAX then ....

        whereas MAX represents the biggest value in the records for the
        displaygroup field (an integer datatype). I get an "Either BOF or EOF
        is True, or the current record has been deleted.." error if i put any
        type of comparison number (of course MAX is not a vbscript keyword)
        that is larger than my largest displaygroup value in the dbase , as I
        will loop thru all the records once this condition is met.

        thanks
        chum


        Comment

        Working...