yes/no box=$, Then Total at end of form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What I have,
a vet office, with an intake form
on the intake form are three fields relating to services offered at the vets
office.
the three services, rabies, sterlization, nail all come out to dollar amounts.

if the check box is checked yes, we would like the dollar amounts of each
field to tally up at the end of the form.

attempted creating an unbound frame field called strTotal or total or
anything of that nature, but that didn't seem to do a thing.

attempted with out a specific named field for the table and its form.

that also did not work. below is the code i have at the moment.

any ideas?


Option Compare Database

Private Sub Form_AfterUpdate()

'Cost of procedures on animal intake form. Declaring Variables.
Dim sngTotal As Single
Dim sngRabies As Single
Dim sngSpay As Single
Dim sngNail As Single
'Input amounts from boxes checked True on Intake Form.
If (Rabies = True) Then sngRabies = 12
If (Nail = True) Then sngNail = 2
If (Sterlization = True) Then sngSpay = 63
'Calculate the procedures.
sngTotal = sngRabies + sngSpay + sngNail
End Sub
 
With this problem I would:
Create three matching fields to store the dollar amounts (let's say
txtRabies, txtSpay and txtNail).
Create three After_Update events (one for each tick box) to type/clear the
amount in the matching dollar field, e.g. (if chkRabies is the name of the
Rabies tickbox):

If chkRabies Then
txtRabies = 12
Else
txtRabies = 0
End If

Create the total field as an unbound text box adding the three dollar
textboxes:
=txtRabies+txtSpay+txtNail

Just another approach - and remember that the name of a control on the form
might not be the same as the name of the underlying field (the source of a
lot of headaches!).
 
Back
Top