Record counter gives wrong answer

Creating tables and queries
Post Reply
User avatar
MikeytheMagnificent
Posts: 137
Joined: Fri Apr 11, 2008 12:06 am
Location: W. Yorks UK

Record counter gives wrong answer

Post by MikeytheMagnificent »

If I open seemingly any old table in table view with more than a pageful of records say 203, the record counter at the bottom of the screen announces
"record 1 of 33"
where the screen is displaying about 31 records, why??. As I spin the mousewheel down the records the number of records keeps updating by 3 then after a few of those by 30, then by some other seemingly random number until the final 30 records come into view. Once the actual final and correct count is displayed all is ok until the table is closed and all the miscounting starts again
If I then design a couple of quick forms one as a table the other as sequential records, in both cases random misreporting occurs by different multiples until the last record has been viewed to correct the count

Why? What? How? Can I cope? please!
I thought this would have been Topic-ed years back, but see no mention on the boards, at least not where I'm looking.

Thanks for being patient
Many opportunities to add short Tutorials or faq's are missed

1. Must have obvious title to be found easily
2. Keep to objectives
3. Use very clear language
4. Difficult to get right
5. Rewards are few
User avatar
TheGurkha
Volunteer
Posts: 6482
Joined: Thu Mar 13, 2008 12:13 pm
Location: North Wales, UK.

Re: Record counter gives wrong answer

Post by TheGurkha »

This is pretty standard for this type of database program. Until the file has been traversed it doesn't know how many records are in the file.
Ubuntu 14.10 Utopic Unicorn, LibreOffice Version: 4.3.3.2
Gurkha Welfare Trust
User avatar
MikeytheMagnificent
Posts: 137
Joined: Fri Apr 11, 2008 12:06 am
Location: W. Yorks UK

Re: Record counter gives wrong answer

Post by MikeytheMagnificent »

Thanks Gurkha,
It knows correctly from the moment the last record fits onto the visible screen, whether or not any clicking has gone on, is there a slick way of auto-forcing the record counter to self correct if the Viewer Object is a Form? say?
I've no idea but can I just
View Last>View First
automatically by Macro or somewayelse?
It may be important not to display barefaced lies by default :oops:
Many opportunities to add short Tutorials or faq's are missed

1. Must have obvious title to be found easily
2. Keep to objectives
3. Use very clear language
4. Difficult to get right
5. Rewards are few
User avatar
TheGurkha
Volunteer
Posts: 6482
Joined: Thu Mar 13, 2008 12:13 pm
Location: North Wales, UK.

Re: Record counter gives wrong answer

Post by TheGurkha »

You might be able to do this by going to the last record and back again, using a macro, but I'm not sure. And I don't know OOo macro stuff yet.
Ubuntu 14.10 Utopic Unicorn, LibreOffice Version: 4.3.3.2
Gurkha Welfare Trust
eremmel
Posts: 1080
Joined: Tue Dec 30, 2008 1:15 am

Re: Record counter gives wrong answer

Post by eremmel »

There is also an issue with definition. Does the record numbers reflect the information in the database or just the records loaded by the form? I think it is the latter. It might become more intuitive when you consider the fact that when you apply a filter via the 'data table' or 'form navigation' bar the amount of records reflects the filter condition. Note that there is always an * behind the 'total' or 'of count' record number when not all records are fetched. With this in mind is the information on the form still sometimes a lie?
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
User avatar
MikeytheMagnificent
Posts: 137
Joined: Fri Apr 11, 2008 12:06 am
Location: W. Yorks UK

Re: Record counter gives wrong answer

Post by MikeytheMagnificent »

Thanks Ghurka you pointed me in exactly the right direction, but please don't lose faith yet!

and thanks eremmel for keeping this thread alive and advice . Sorry but I lost your drift in the last couple of lines

Its too important to let it die. Not only is it important that We all know about this problem it can be dangerous if at a glance we are told and expect a table or form to contain a pageful of records (about 30) when it actually contains '00s or '000s our viewing stacks the odds a certain way and we may go out and bet our shirt on a three legged donkey.

First time ever, I set up and open a form in which I record a macro, by mousing to the last record (click), then immediately back to the first (click), which updates the record counter to read record 1 of 243, great, but how do I automate and amalgamate the form-open part with the auto-clicky part, because until I get a form open, I can't record another macro (at primary level like me). to open itself and then to carry on and run the one that's working already.
Ah! since I can't do it directly, because the form design button is greyed, I must close it and use the form-edit doo daa in the main database window, where I click the toolbar button marked "form" which reveals not a "record macro" possibility but 3 tabs, from which the events tab makes available a "when loading" event to which I attach ... my update-records macro
Many opportunities to add short Tutorials or faq's are missed

1. Must have obvious title to be found easily
2. Keep to objectives
3. Use very clear language
4. Difficult to get right
5. Rewards are few
User avatar
MikeytheMagnificent
Posts: 137
Joined: Fri Apr 11, 2008 12:06 am
Location: W. Yorks UK

Re: Record counter gives wrong answer

Post by MikeytheMagnificent »

sorry but this intolerant text editor's got me again :crazy: and dumped my last paragraph of my last post :crazy:

I went on to say "How can I now track back even further" and exclude my viewers from almost everywhere, by setting up preferably a desktop shortcut directly to my corrected form or to a control panel or dashboard.

No geeky "Writer" menuy toolbary status bar stuff or "Base" main window stuff. Just a shoebox on the desktop called "Mikeys Magnificent Moneymaking System" "Press the Button to continue"
Many opportunities to add short Tutorials or faq's are missed

1. Must have obvious title to be found easily
2. Keep to objectives
3. Use very clear language
4. Difficult to get right
5. Rewards are few
eremmel
Posts: 1080
Joined: Tue Dec 30, 2008 1:15 am

Re: Record counter gives wrong answer

Post by eremmel »

I like to continue with you the discussion. The records number is not the amount of records in the database. It is only the number of records *loaded* by the form. When more records can be loaded it is indicated with a '*' as in the following below.
Record counter without an with all records loaded from database
Record counter without an with all records loaded from database
Records.png (9.84 KiB) Viewed 8608 times
. When I apply a filter on my data, I limit the amount of records that I can view in my form. So the total amount of records is than lower. See second picture.
Total number of records in form when a filter is active.
Total number of records in form when a filter is active.
FilteredRecords.PNG (1.21 KiB) Viewed 8608 times
This is also implicitly the case when you do have a SQL query as source for your form. The where clause contains a filter condition. Esp for larger data sets and complex filter conditions, the 'goto the last records and back' action can make loading of a form very time consuming (It might take minutes to open a form).
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
User avatar
MikeytheMagnificent
Posts: 137
Joined: Fri Apr 11, 2008 12:06 am
Location: W. Yorks UK

Re: Record counter gives wrong answer

Post by MikeytheMagnificent »

Sorry, I never noticed the * before, you very clever Dutchman

So how do I control the record loading, for me it just loads a screenful, give or take a couple!
Are you saying that if I load via sql and filter I can regain control and turbo the loading?

In my case it is only the record count that matters right now. My form has no fields displayed just yet, so the current record number is meaningless. I hide the default record selector/counter together with the VCR navigator and desire to show a custom version instead, all that matters is that it is correct!! :super: but where do I aquire one? :knock: Is it a OOBasic job from my existing macro or what?

If all else fails, Presumably a report will give me access to a COUNT function, but I'm wanting a form, which I know is close, but is it close enough?
so far I can't even get SRB to work and the internal report wizard never even loads
Many opportunities to add short Tutorials or faq's are missed

1. Must have obvious title to be found easily
2. Keep to objectives
3. Use very clear language
4. Difficult to get right
5. Rewards are few
eremmel
Posts: 1080
Joined: Tue Dec 30, 2008 1:15 am

Re: Record counter gives wrong answer

Post by eremmel »

If you are only interested in the record count, make one yourself by adding a sub-form with a query that counts the records e.g.:

Code: Select all

 SELECT COUNT(*) AS "Records" FROM "<your-table-name>"
Add a numeric field to this sub-form and assign the data-field "Records" to the control.
Here is the result I got:
A counter field as the result of a query attached to a subform
A counter field as the result of a query attached to a subform
RecordsField.PNG (1.85 KiB) Viewed 8593 times
. Use the the "FormNavigator" shows to add a sub form to the Mainform. Add a number and lable field drag/drop those to the sub-form with help of the navigator. Here is an example of the structure:
Form structure
Form structure
RecordCounterForm.PNG (13.41 KiB) Viewed 8593 times
It's Microsoft marketing that tells you computers are qualified for non-technicians
W11 22H2 (build 22621), LO 7.4.2.3(x64)
Post Reply