Thanks for that. I've never done any coding before. The following is the
exact calculation that I now have inserted into the control source. Would
you be able to translate that into the appropriate event code? Also, after
thats done am I correct then that the control source should once again be
changed back to the inderlying table field?
Thanks,
FJquestioner
=IIf(Forms![Assignment
Requests]!Advance_Percent<[Debtors_AdvanceRate],Forms![Assignment
Requests]!Advance_Percent,[Debtors_AdvanceRate])-[AllowableDiscountPct]
In essence, the calculated field is simply the lessor of the field called
Advance_Percent and the sum of two other firled called Debtors_AdvanceRate
and AllowableDiscountPct.
I hope I've explained this clearly!
Sorry for being so long getting back to you.
You'ld view the Properties of the form. This control should be bound
to the desired table field (you don't say what that fieldname or the
controlname is, I'll assume that the textbox is named CalcPercent and
that its Control Source is the field which should be stored).
Open the form in design view; select the Advance_Percent field, and
find the AfterUpdate event on its Events tab. Click the ... icon and
choose "Code Builder". Access will give you the Sub and End Sub lines;
edit it to the following (copy and paste should work):
Private Sub Advance_Percent_AfterUpdate()
' Check to see if all three fields have data
If Not IsNull(Me!Advance_Percent) _
And Not IsNull(Me!AdvanceRate) _
And Not IsNull(Me!AllowableDiscountPct) Then
' only calculate the result if it's empty
If IsNull(Me!CalcPercent) Then
If Me![Advance_Percent] < Me![Debtors_AdvanceRate] Then
Me!CalcPercent = Me!Advance_Percent
Else
Me!CalcPercent = Me!Debtors_AdvanceRate _
- Me!AllowableDiscountPct
End If
End If
End If
End Sub
John W. Vinson[MVP]