Board index » delphi » Retrieving record number from Access 97 tables / queries

Retrieving record number from Access 97 tables / queries

Hi,

I try something which sounds simple but I could not solve it.

I have a Query, which is based on an Access 97 table. The result of the
query is shown in a DBGrid component on a from.

In a label control I want show the current record number of the query, on
which the user has placed the cursor. This functionality I have placed in
the OnDataChange event procedure of the Grid's datasource (which is linked
to the query).
I tried the RecNo property of the TQuery component, but this always
returns -1, when the user changes the row position in the grid. At some
point I have read the the RecNo property in the TDataSet component is
somewhat abstract and returns always -1. However, I expected this to work at
least from the TQuery component.

As an alternative I tried with BDE-Api calls, but DbiGetSeqNo() apparently
does not support Access tables / queries.

Also I could not find any appropriate property of the DBGrid to supply the
number of the current row of the grid.

So, what would be the best approach to get the Query record number in this
case ?

May be it is a simple question, but I am still on my upward learning path in
using Delphi.

Thanks in advance.

Thomas Gulden
Email: thomasgul...@csi.com

 

Re:Retrieving record number from Access 97 tables / queries


There is no record number for an Access table.

Bill

--
Bill Todd
(Sorry but TeamB cannot answer questions received via email)
(Remove nospam from my email address to contact me for any other reason)

Re:Retrieving record number from Access 97 tables / queries


Thomas,

Since "row number" mean nothing in a SQL environment, could you use the
Grid's row number instead???

Just an idea,
--Raymond

Re:Retrieving record number from Access 97 tables / queries


If it is imperative, I would add an integer field to my dataset and manually
use it as a record number...

Thomas Glden escribi en mensaje <7aknfd$gm...@forums.borland.com>...

Quote
>Hi,

>I try something which sounds simple but I could not solve it.

>I have a Query, which is based on an Access 97 table. The result of the
>query is shown in a DBGrid component on a from.

>In a label control I want show the current record number of the query, on
>which the user has placed the cursor. This functionality I have placed in
>the OnDataChange event procedure of the Grid's datasource (which is linked
>to the query).
>I tried the RecNo property of the TQuery component, but this always
>returns -1, when the user changes the row position in the grid. At some
>point I have read the the RecNo property in the TDataSet component is
>somewhat abstract and returns always -1. However, I expected this to work
at
>least from the TQuery component.

>As an alternative I tried with BDE-Api calls, but DbiGetSeqNo() apparently
>does not support Access tables / queries.

>Also I could not find any appropriate property of the DBGrid to supply the
>number of the current row of the grid.

>So, what would be the best approach to get the Query record number in this
>case ?

>May be it is a simple question, but I am still on my upward learning path
in
>using Delphi.

>Thanks in advance.

>Thomas Gulden
>Email: thomasgul...@csi.com

Other Threads