Calculating fields in a form 
Author Message
 Calculating fields in a form

Hi Shona,

I would suggest that you use 0,1,2,3 instead of 1,2,3,4 as the scores.
Then, if these are the only dropdowns in the document and you have another
text formfield (Text1) in which you want the total score to appear, if you
run a macro containing the following commands on exit from each of the
dropdown fields, the Text1 formfield will be updated with the total score
every time the user exits one of the dropdowns:

Dim Score As Integer, ffield As FormField
Result = 0
For Each ffield In ActiveDocument.FormFields
    If ffield.Type = wdFieldFormDropDown Then
        Score = Score + Val(ffield.Result)
    End If
Next ffield
ActiveDocument.FormFields("Text1").Result = Score

Please post any response to the newsgroups for the benefit of others who may
also be following the thread.

Hope this helps,
Doug Robbins - Word MVP

Quote:
> I've got a Word form for users to complete which is an
> assessment for training.

> What I;ve done is put drop down fields to chose a score
> per module i.e.

> 1 = Nothing
> 2 = Little
> 3 = Some
> 4 = Extensive

> What I want to do is in a cell below the table calculate
> these as values. How do I do this? At the very end of the
> assessment I want a calculation that adds all totals to
> make a grand total score.

> Help!



Sun, 15 May 2005 17:58:43 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. How to refresh calculated fields in a form ?

2. Calculating a field from same row for each row/record in form

3. Losing Calculated Form Field Data after File Save

4. Form field to calculate total

5. Autorefreshing calculated fields on forms

6. data control, forms, calculated fields?

7. table.field value calculated based on query

8. Creating Calculated field in table

9. Calculating Average of Grade Fields

10. Updating Calculated field depending on Current Date

11. Changing a Calculate field (Date) depending on Current date

12. calculating a field in a query...

 

 
Powered by phpBB® Forum Software