Question : MS Access - automatically populate text field

I am using a form in MS Access 2007.  The user responds  to a series of questions using True/Flase option buttons.  Based on the response, a value is passed and a running total is kept and then passed to a table.  Based on the score, each record should be given a class value.

For example
score 0 - 11 = Class 1
score 12-14 = Class2
score 15-18 = Class 3

How can I add a field to my form that displays the class as the score changes and then store in a table?

Answer : MS Access - automatically populate text field

In summary.
You have a text box now that "a value is passed and a running total" which has the score (?).

Create a text box ... say txtClass that has the Switch expression I showed above.  This should ... update each time the score changes.  If not, then you may need to put this in the AfterUpdate event of the Option Group ("True/Flase option buttons") :

Me.ReCalc

which will force a recalculation of all calculated controls on the form.

Finally ... in the Form Before Update ... as before ... you would put this:

Me![YourClassFieldNameInTheTable] = Me.txtClass

mx
Random Solutions  
 
programming4us programming4us