Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with access form

Status
Not open for further replies.

snipesnab

IS-IT--Management
Oct 24, 2002
171
0
0
GB
I have a table with the following fields:

autonumber
total bill amount
barry
mark
luke
john

I have created a form from these fields, on the form i want to manually add the amount for the 'total bill amount' on the form, and once this has been added i automatically want this amount to be divided by 4 (the amount of names) and then the answer to be placed in each of the name fields (eg, barry,mark,luke,john). does anyone know how i do this?

Many thanks, Barry
 
You need to add some code to your form.
Are you Ok with this?
You will need to look at event properties for the TotalBillAmount textbox.


 
The question is: can you be sure that there will always be 4 names? If so, then the answer is really simple: The default value for each of the 4 names is

me.txttotalbillamount]/4

This is the total bill amount divided by 4. You may have to put a me.requery statement in the the VBA code for the afterupdate property of txttotalbillamount (which is what I'm calling the control that contains the value of the column total bill amount).

You could provide more flexibility in one of two ways:

1. have 2 tables. One with autonumber, Total bill amount
The second with the main table's automnumber column, person. (It could also include an amount column if you wanted to allow for non-equal sharing.)

2. if the amounts are always divided equally and you can predefine the specific names and are sure that there are never more than 4 (8? 10?) specific names, each name column could be a simple true/false column. The user would just check off (set to true) each name that participated in that bill. The amounts could be displayed but not stored as the total bill amount divided by the count of the true columns.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top