Creating Expression

N

Nirav

Hi,

I have created forms by using the Wizard from table.

In form there are two comboboxes named"Biceps" and "Elbow" and one textbox
"Total" . Now for example, if score of "Biceps" is 2 and score of "Elbow" is
3 then "Total" of values should be 5.

How can I creat a formula (Expression) that automatically adds value from
field "Biceps" and "Elbow"?

Please help.
 
D

Douglas J. Steele

Since the only time the value of Total will change is if one or both of the
combo boxes change, all you should need to do is put code in the AfterUpdate
event of the two combo boxes:

Private Sub Biceps_AfterUpdate()

Me.Total = Nz(Me.Biceps, 0) + Nz(Me.Elbow, 0)

End Sub

Private Sub Elbow_AfterUpdate()

Me.Total = Nz(Me.Biceps, 0) + Nz(Me.Elbow, 0)

End Sub

If the combo boxes are bound, so that there's a selected value as each
record is loaded, put that in the form's Current event as well:

Private Sub Form_Current()

Me.Total = Nz(Me.Biceps, 0) + Nz(Me.Elbow, 0)

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top