how to use Abs

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?
 
G

Guest

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"))
 
G

Guest

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?
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top