drisconsult
Drisconsult
- Local time
- Today, 18:37
- Joined
- Mar 31, 2004
- Messages
- 125
I have recently been having detailed conversations with the fundi's (Swahili for expert) at Access Forums concerning calculating a rolling average when the denominator was unknown. I have to be honest and say that most of the replies were beyond my Visual Basic levels.
However, I keep a record of everything I have written and suddenly remember that I had a similar problem in 1998 with Access 97 and had resolved it. And I have resolved the problem, although I do not think that purist would agree with my solution. So here it is.
I created this expression on the 14 fields where I had to enter a number.
=IIf([LSUB01] Is Not Null And [LSUB01],1,0) x 14
I then added these fields together as shown on the graphic.
The third graphic shows the result I received.. My expression has successfully counted the fields with data in them, which in this case is 12 and given me the correct average. The fourth screenshot shows the correct answer when 14 subjects are taken.
The fourth screenshot also highlights a problem I cannot resolve. The answer has shown fifteen decimal places, when it should only show 1. I have every combination possible to eliminate this problem but have failed. When only the answer is shown, there is no problem, but the moment it is combined with text, I see the huge number of decimal place. The white answer showing the count will be hidden on the final form.
I would be very grateful for a solution to this problem.
Terence Driscoll
London
However, I keep a record of everything I have written and suddenly remember that I had a similar problem in 1998 with Access 97 and had resolved it. And I have resolved the problem, although I do not think that purist would agree with my solution. So here it is.
I created this expression on the 14 fields where I had to enter a number.
=IIf([LSUB01] Is Not Null And [LSUB01],1,0) x 14
I then added these fields together as shown on the graphic.
The third graphic shows the result I received.. My expression has successfully counted the fields with data in them, which in this case is 12 and given me the correct average. The fourth screenshot shows the correct answer when 14 subjects are taken.
The fourth screenshot also highlights a problem I cannot resolve. The answer has shown fifteen decimal places, when it should only show 1. I have every combination possible to eliminate this problem but have failed. When only the answer is shown, there is no problem, but the moment it is combined with text, I see the huge number of decimal place. The white answer showing the count will be hidden on the final form.
I would be very grateful for a solution to this problem.
Terence Driscoll
London