L
LindaBee
Hi All
I have a puzzling problem and I cannot figure out where I am going wrong
perhaps the experts can help me out here!
I have created a form in my database that calculates payment based on the
value in one field. I have a field called Question1A and a Text field called
Text1A I enter a value in Question1A and the calcualtions are displayed in
Text1A and the I have 2 ore fields Question2B and Text2B the combined values
in Question1A and Question1B calculate This works ok except when I enter a
new record the values from the previous record are displayed and I have to
refresh the screen for the default values to be displayed.
I have tried enterring the calculations in the before and after update and
on form load
Question1A and Question1B are both manual entries by user
here is a sample of the code
The first function calculates what goes into Text1A
Private Sub Question1A_BeforeUpdate(Cancel As Integer)
If Me.Question1A = "A" Then
Me.Text1A = 12* 0
Else
If Me.Question1A = "B" Then
Me.Text1A = 12* 0.5 * 3
Else
If Me.Question1A = "C" Then
Me.Text1A = CalculatorField * 4 * 0.5
Else
End If
End If
End If
what goes into Text1B
Private Sub Question1B_BeforeUpdate(Cancel As Integer)
If Me.Question1A = "A" And Me.Question1B = "1" Then
Me.Text1B = Me.Text1A * 2
Else
If Me.Question1A = "A" And Me.Question1B = "2" Then
Me.Text1B = Me.Text1A * 4
ElseIf Me.Question1A = "B" And Me.Question1B = "1" Then
Me.Text1B = Me.Text1A * 6
Else
If Me.Question1A = "B" And Me.Question1B = "2" Then
Me.Text1B = Me.Text1A * 8
Else
End If
End If
End If
Please please HELP!!!
I have a puzzling problem and I cannot figure out where I am going wrong
perhaps the experts can help me out here!
I have created a form in my database that calculates payment based on the
value in one field. I have a field called Question1A and a Text field called
Text1A I enter a value in Question1A and the calcualtions are displayed in
Text1A and the I have 2 ore fields Question2B and Text2B the combined values
in Question1A and Question1B calculate This works ok except when I enter a
new record the values from the previous record are displayed and I have to
refresh the screen for the default values to be displayed.
I have tried enterring the calculations in the before and after update and
on form load
Question1A and Question1B are both manual entries by user
here is a sample of the code
The first function calculates what goes into Text1A
Private Sub Question1A_BeforeUpdate(Cancel As Integer)
If Me.Question1A = "A" Then
Me.Text1A = 12* 0
Else
If Me.Question1A = "B" Then
Me.Text1A = 12* 0.5 * 3
Else
If Me.Question1A = "C" Then
Me.Text1A = CalculatorField * 4 * 0.5
Else
End If
End If
End If
what goes into Text1B
Private Sub Question1B_BeforeUpdate(Cancel As Integer)
If Me.Question1A = "A" And Me.Question1B = "1" Then
Me.Text1B = Me.Text1A * 2
Else
If Me.Question1A = "A" And Me.Question1B = "2" Then
Me.Text1B = Me.Text1A * 4
ElseIf Me.Question1A = "B" And Me.Question1B = "1" Then
Me.Text1B = Me.Text1A * 6
Else
If Me.Question1A = "B" And Me.Question1B = "2" Then
Me.Text1B = Me.Text1A * 8
Else
End If
End If
End If
Please please HELP!!!