AbsolutePosition Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob

    #1

    AbsolutePosition Problem

    Using ODBC to a SQL database I use the code;
    Label1.Caption = record_rst.Abso lutePosition & " of " &
    record_rst.Reco rdCount giving '4 of 256' for example. My problem, I am now
    connecting to an MS Access database and it is returning ... '-1 of 256' any
    suggestions
  • Scott M.

    #2
    Re: AbsolutePositio n Problem

    It sounds like you are still using ADO Recordsets, rather than ADO .NET
    DataTables and DataSets, right?

    AbsolutePositio n and RecordCount were never recommended for reliable results
    in ADO since updates by others could throw those values off. If you are
    recieving -1 for AbsolutePositio n, it's probably because you are positioned
    prior to the first record at the Beginning Of File (BOF) marker.

    You should consider using ADO .NET and loading your data into DataTables &
    DataSets. You could then use the index value of a given record in the
    DataTable's Row collection.

    -Scott

    "Bob" <Bob@discussion s.microsoft.com > wrote in message
    news:67DB7965-417C-4D06-874E-AF0406426F33@mi crosoft.com...[color=blue]
    > Using ODBC to a SQL database I use the code;
    > Label1.Caption = record_rst.Abso lutePosition & " of " &
    > record_rst.Reco rdCount giving '4 of 256' for example. My problem, I am
    > now
    > connecting to an MS Access database and it is returning ... '-1 of 256'
    > any
    > suggestions[/color]


    Comment

    • Scott Emick

      #3
      Re: AbsolutePositio n Problem

      Its probably becuase you are not using client sided cursor. Make sure you
      set the .cusorlocation of the recordset to 3 (adUseClient) prior to opening
      to get an accurate recordcount.

      Scott Emick
      VB Programmer



      "Scott M." <s-mar@nospam.nosp am> wrote in message
      news:%23j5argTv FHA.3472@TK2MSF TNGP10.phx.gbl. ..[color=blue]
      > It sounds like you are still using ADO Recordsets, rather than ADO .NET
      > DataTables and DataSets, right?
      >
      > AbsolutePositio n and RecordCount were never recommended for reliable
      > results in ADO since updates by others could throw those values off. If
      > you are recieving -1 for AbsolutePositio n, it's probably because you are
      > positioned prior to the first record at the Beginning Of File (BOF)
      > marker.
      >
      > You should consider using ADO .NET and loading your data into DataTables &
      > DataSets. You could then use the index value of a given record in the
      > DataTable's Row collection.
      >
      > -Scott
      >
      > "Bob" <Bob@discussion s.microsoft.com > wrote in message
      > news:67DB7965-417C-4D06-874E-AF0406426F33@mi crosoft.com...[color=green]
      >> Using ODBC to a SQL database I use the code;
      >> Label1.Caption = record_rst.Abso lutePosition & " of " &
      >> record_rst.Reco rdCount giving '4 of 256' for example. My problem, I am
      >> now
      >> connecting to an MS Access database and it is returning ... '-1 of 256'
      >> any
      >> suggestions[/color]
      >
      >[/color]


      Comment

      • Scott M.

        #4
        Re: AbsolutePositio n Problem

        But, if you are going to do this, you might as well just use ADO .NET and
        gain all the other benefits of it.


        "Scott Emick" <semick@ham.f ox-international.c om> wrote in message
        news:eJDgFFVvFH A.2540@TK2MSFTN GP09.phx.gbl...[color=blue]
        > Its probably becuase you are not using client sided cursor. Make sure you
        > set the .cusorlocation of the recordset to 3 (adUseClient) prior to
        > opening to get an accurate recordcount.
        >
        > Scott Emick
        > VB Programmer
        >
        >
        >
        > "Scott M." <s-mar@nospam.nosp am> wrote in message
        > news:%23j5argTv FHA.3472@TK2MSF TNGP10.phx.gbl. ..[color=green]
        >> It sounds like you are still using ADO Recordsets, rather than ADO .NET
        >> DataTables and DataSets, right?
        >>
        >> AbsolutePositio n and RecordCount were never recommended for reliable
        >> results in ADO since updates by others could throw those values off. If
        >> you are recieving -1 for AbsolutePositio n, it's probably because you are
        >> positioned prior to the first record at the Beginning Of File (BOF)
        >> marker.
        >>
        >> You should consider using ADO .NET and loading your data into DataTables
        >> & DataSets. You could then use the index value of a given record in the
        >> DataTable's Row collection.
        >>
        >> -Scott
        >>
        >> "Bob" <Bob@discussion s.microsoft.com > wrote in message
        >> news:67DB7965-417C-4D06-874E-AF0406426F33@mi crosoft.com...[color=darkred]
        >>> Using ODBC to a SQL database I use the code;
        >>> Label1.Caption = record_rst.Abso lutePosition & " of " &
        >>> record_rst.Reco rdCount giving '4 of 256' for example. My problem, I am
        >>> now
        >>> connecting to an MS Access database and it is returning ... '-1 of 256'
        >>> any
        >>> suggestions[/color]
        >>
        >>[/color]
        >
        >[/color]


        Comment

        Working...