Sum

J

Jens R. Rasmussen

I'm very new in access, so please forgive me for this simple question.

I have a table (called TILMELDING) containing a field called HVILKET. It can
have one of 2 values, i.e. "kommer" or "ikke kommer". Another field is HVAD
which contains a number, ie. 091003, 091004, 091005, and so on.

I have a report. When I start it I am requested to tell which numbers from
HVAD I would like to see. I choose for instance HVAD = 091004.

Now I get a listing of alle record which have the field HVAD = 091004. Some
of them have HVILKET = "kommer" and some others have HVILKET = "ikke kommer"

Now I would very must like to count the numbers in the list which have the
HVILKET = kommer.

I guess that I have to write something like

= Sum ( [Tilmelding]![Hvilket] <kommer>)
however this does not work, so my syntax is incoorect. Please help.


regards
Jens
 
D

Duane Hookom

Set the control source to:
=Sum(Abs([Hvilket]="kommer"))
The expression in the middle: [Hvilket]="kommer" will result in either 0
for False or -1 for True. Abs() changes the negative to positive and Sum()
adds them.
 
J

Jens R. Rasmussen

Thank you very much. It works, of course :)

Can you give me a link to a place where I can read about these functions, so
I do not have to bother you again with such elementary questions?

best regards
/jens

Duane Hookom said:
Set the control source to:
=Sum(Abs([Hvilket]="kommer"))
The expression in the middle: [Hvilket]="kommer" will result in either 0
for False or -1 for True. Abs() changes the negative to positive and Sum()
adds them.

--
Duane Hookom
Microsoft Access MVP


Jens R. Rasmussen said:
I'm very new in access, so please forgive me for this simple question.

I have a table (called TILMELDING) containing a field called HVILKET. It can
have one of 2 values, i.e. "kommer" or "ikke kommer". Another field is HVAD
which contains a number, ie. 091003, 091004, 091005, and so on.

I have a report. When I start it I am requested to tell which numbers from
HVAD I would like to see. I choose for instance HVAD = 091004.

Now I get a listing of alle record which have the field HVAD = 091004. Some
of them have HVILKET = "kommer" and some others have HVILKET = "ikke kommer"

Now I would very must like to count the numbers in the list which have the
HVILKET = kommer.

I guess that I have to write something like

= Sum ( [Tilmelding]![Hvilket] <kommer>)
however this does not work, so my syntax is incoorect. Please help.


regards
Jens
 
D

Duane Hookom

Your question isn't all that elementary. I probably found the answer here
many years ago and just restate it regularly.

The solution depends on applying a couple different concepts together.

--
Duane Hookom
Microsoft Access MVP


Jens R. Rasmussen said:
Thank you very much. It works, of course :)

Can you give me a link to a place where I can read about these functions, so
I do not have to bother you again with such elementary questions?

best regards
/jens

Duane Hookom said:
Set the control source to:
=Sum(Abs([Hvilket]="kommer"))
The expression in the middle: [Hvilket]="kommer" will result in either 0
for False or -1 for True. Abs() changes the negative to positive and Sum()
adds them.

--
Duane Hookom
Microsoft Access MVP


Jens R. Rasmussen said:
I'm very new in access, so please forgive me for this simple question.

I have a table (called TILMELDING) containing a field called HVILKET. It can
have one of 2 values, i.e. "kommer" or "ikke kommer". Another field is HVAD
which contains a number, ie. 091003, 091004, 091005, and so on.

I have a report. When I start it I am requested to tell which numbers from
HVAD I would like to see. I choose for instance HVAD = 091004.

Now I get a listing of alle record which have the field HVAD = 091004. Some
of them have HVILKET = "kommer" and some others have HVILKET = "ikke kommer"

Now I would very must like to count the numbers in the list which have the
HVILKET = kommer.

I guess that I have to write something like

= Sum ( [Tilmelding]![Hvilket] <kommer>)
however this does not work, so my syntax is incoorect. Please help.


regards
Jens
 

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