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

Count Records/Data of a Table

Status
Not open for further replies.

TheLazyPig

Programmer
Sep 26, 2019
106
PH
Hi, I wanted to know the count of records or data in my Grid View. I'm using Label to view the count. Where will I start?
 
One other point about _TALLY. At least, I don't think Olaf mentioned it. Do not use it in any application that involves timers. A timer firing could lead to code running that changes _TALLY, even between consecutive lines of code.

Tamar
 
Hi All,

@ Tamar: Interesting - have to keep that in mind
@ Olaf
_TALLY is very volatile.
I know and that's why I put it precisely at that point. From VFP Hacker's Guide
However, the wide range of commands that affect _TALLY lends itself to all kinds of possibilities. We bet most of you have sections of code that perform one of the commands above, then use COUNT or RECCOUNT() or ALEN() to see how many records were affected (we sure do). And there was _TALLY just waiting to give you the answer.
@ Mike
This is an interesting discussion, and I hope it will continue. But I wonder if we haven't thoroughly confused the OP. He asked a simple question, but he has received vastly more information ...
Sure is. However we all assumed that he is using a table/cursor/view to populate the grid and offered a solution. The answer to his simple question is: he has to be aware that the RECORDSOURCE and the RECORDSOURCETYPE of his grid will strongly impact on the code he has to write to count the records of the grid.

hth

MarK

 
Thank you for the response. I forgot to say that I have a button for viewing the filtered records. I used Sir Mike's code and it works just like what I wanted to. Thank you so much [pc2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top