Averaging values from an option group

StephenB

Registered User.
Local time
Today, 07:54
Joined
Apr 18, 2002
Messages
101
I have a db with tbl_survey that has fields [Q1], [Q2] and [Q3] (for questions 1, 2 and 3). They are set as number fields. On my form frm_tbl_survey I have an option group for each question which assigns a value to [Q1], [Q2] and [Q3] depending on the option selected each question (I'm using option buttons without any default). The values are 1 (satisfied), 2 (neutral) and 3 (unsatisfied).

On the same table (and form)I have [Score].

I'd like the average of the values of [Q1], [Q2] and [Q3] to be displayed in [Score].

I built an expression in the default property of [Score] that reads [Q1]+[Q2]+[Q3]/3. But that didn't work. I kept getting zero as my return in [Score]. Then wrote code [Score]=[Q1]+[Q2]+[Q3]/3 in the on_enter event of [Score]. Now at least I get a number, but it's still a wrong return.

Any comments or suggestions on what I'm doing wrong and how I should correct it?
Thanks in advance.
 
First of all, if you can calculate [Score] from [Q1],[Q2,[Q3], then you shouldn't be storing it in your table. You can calculate it in the query under your form and not have to do any workings on the form, if you need to refer to that value elsewhere.

Also, check the archives for information on 'questionairre database' (I think I'm spelling that right). There's a particular format that works best for them, and storing the questions side by side isn't it.

Good luck,
David R
 

Users who are viewing this thread

Back
Top Bottom