Can a default table value be a calculated value?

pdbowling

Registered User.
Local time
Today, 21:36
Joined
Feb 14, 2003
Messages
179
Hi all,
I have a table...

Amount........Wholesale...........Commission

Lots of other columns but they don't come in to play.

When an Amount is entered, can Wholesale and Commission auto populate with Amount*.9 and Amount *.1 using default values in the table definition? I couldn't quite get the expression builder to understand.

If it can't, how should I get it to work? Forms are OK. As is code.
Thanks
PB
 
Pat is correct if your commission rate is always the same. However, I believe you're wanting a default value of 10%, which you may overwrite. Use a bit of vba code in the after update event of your Amount text box. Like this:
Code:
Private Sub txtAmount_AfterUpdate()
txtWholesale = txtAmount * 0.9
txtCommission = txtAmount - txtWholesale
End Sub
If you want the commission to autocalculate after you amend the wholesale price, add this to the after update event of txtWholesale:
Code:
Private Sub txtWholesale_AfterUpdate()
txtCommission = txtAmount - txtWholesale
End Sub
Of course you may want to swap this around so that you enter the commission and the wholesale is calculated, or even have both at the same time. See the attached sample.
 

Attachments

Users who are viewing this thread

Back
Top Bottom