how to use Abs

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greeting,
I have form with continuous filed format, in this form there is a combo box
Called "Status" which contains two statuses: "entered" and "Exit"
What I want to do is making a textbox to count the number of filed which
have the status "entered". Can any body help me please?
 
The Abs used to return the absolute value of a number

Writing the criteria
[category]="entered"
will return -1 (true) if criteria met

Summing the value of true (-1) will return the total of times the criteria
met ( for example -10)
The Abs will change it to 10

So try writing in the control source of the text box:

=Abs(Sum([category]="entered"))
 
In the example instead of category it should be status

--
Good Luck
BS"D


Ofer Cohen said:
The Abs used to return the absolute value of a number

Writing the criteria
[category]="entered"
will return -1 (true) if criteria met

Summing the value of true (-1) will return the total of times the criteria
met ( for example -10)
The Abs will change it to 10

So try writing in the control source of the text box:

=Abs(Sum([category]="entered"))


--
Good Luck
BS"D


Jon said:
Greeting,
I have form with continuous filed format, in this form there is a combo box
Called "Status" which contains two statuses: "entered" and "Exit"
What I want to do is making a textbox to count the number of filed which
have the status "entered". Can any body help me please?
 
Sum the return value of an expression which returns 1 or 0. Use the IIf
function for this rather than relying on the implementation of Boolean TRUE
and FALSE values in Access as -1 and 0. Being "unduly chummy with the
implementation", as the head of one software company once termed it, is
considered poor programming practice in principle as there can be no
guarantee that the implementation will not change at some time in the future.
The expression to count the number of rows with the value "entered" would
thus be something like this:

Sum(IIf([YourField] = "entered",1,0))

Ken Sheridan
Stafford, England
 
Back
Top