Sum

  • Thread starter Thread starter Jens R. Rasmussen
  • Start date Start date
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
 
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.
 
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
 
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
 
Back
Top