Limiting lines in a table (1 Viewer)

Russp42

Registered User.
Local time
Yesterday, 23:55
Joined
Nov 27, 2017
Messages
53
I have a table which has lines 1-18. On completion of the last line the cursor goes to line 19 to enable entry of new record. I have a form based on this table which has a number of calculated fields. The formulas are carrying down to row 19 even though I have not entered a new record. This is preventing me from performing some calculations on these calculated fields(eg Totals) How can I limit the table to only show lines containing data (18 lines)
 

Tieval

Still Clueless
Local time
Today, 07:55
Joined
Jun 26, 2015
Messages
475
Set the properties of the form to Data Entry - NO and this will remove the additional blank record.
 

isladogs

MVP / VIP
Local time
Today, 07:55
Joined
Jan 14, 2017
Messages
18,207
As well as doing the change Tieval suggested, I would look at your formulas as totals shouldn't be affected by a blank new row anyway.
 

jleach

Registered User.
Local time
Today, 02:55
Joined
Jan 4, 2012
Messages
308
You can also turn off AllowAdditions in the form properties. I've always done that rather than using the DataEntry property (no particular reason why, except the the AllowAdditions/Edits/Deletes seemed a more semantic set of properties to me)

Cheers
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:55
Joined
Feb 28, 2001
Messages
27,122
Jack's suggestion (controlling "AllowAdditions") is very effective. I have used that myself many times in dynamic situations where you have to go through a specific procedural path to be allowed to add something to the table through the bound form. At least once I used it where it was based on the user's role as recorded in the Users table that built.
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:55
Joined
May 7, 2009
Messages
19,226
What are the formula for the Calculated fields?
you cant control the behaviour of the calc fields. Once you start typing on new record and goes to next field, the calc field will calc itself. The smart thing to do is make sure to default to 0 those field included in the cakc field, eg:

Suppose you have numeric fields A and B.
The calc field C expression is A + B.

Change the expression in C to:

Iif(IsNull(A), 0, A) + Iif(IsNull(B), 0, B)
 

arnelgp

..forever waiting... waiting for jellybean!
Local time
Today, 14:55
Joined
May 7, 2009
Messages
19,226
Still the computation is correct until he fills all info.
Post #1 says its total not average.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:55
Joined
Feb 19, 2002
Messages
43,196
If you have a problem adding new records, your code is in the wrong form events. You are dirtying a record before the user starts entering data and that is causing the problem.
 

Users who are viewing this thread

Top Bottom