Jump to content
Sign in to follow this  

Calculation for related fields in the same record

Recommended Posts

I am creating a database for a personal training business. I have a "Trainer Worksheet" table. The records for that table look something like this:

Contract# Total Sessions Rate Per Session

A1(field) B1 (field) C1 (field)

A2(field) B2 (field) C2 (field)

The "Trainer Worksheet" table is related to a "Contracts" table through a "Trainers Code" field. When the Trainers Code is entered into the "Trainers Worksheet" record, a value list is created in A1 with a list of contracts that are assigned to that trainer (via Trainer Code).

What I need to have happen is that when a contract value is selected in A1, B1 automatically is entered with the data from the contract A1 specifies.

So, say contract # 102 is entered into A1. I would need B1 and C1 to reference contract # 102 and enter the total # of sessions and rate per session from that contract. Each contract is a different record in the "Contracts" table.

Is there any way to do this with a calculation?

Share this post

Link to post
Share on other sites

Hi candersoncscs, welcome to FM Forums!

You would establish a relationship (if you don't already have one), joining Trainer Worksheet::Contract# to Contracts::Contract# using [color:blue]=. Then, within Trainer Worksheet, you would go to the options (in field definitions) for Total Sessions and, under the auto-enter tab, select 'calculated value'. In the calculation dialog above left, find your Contracts table from the pop-up and double-click the Total Sessions field. Repeat for the Rate Per Session field. You could also use the auto-enter Lookup feature but I prefer auto-enter when possible.

There is one thing ... if a Contract can't change once established and if you always create NEW contracts for future work, then you really don't need to duplicate the information within Trainer Worksheet - you can simply place the Contract::Total Sessions and Contract::Rate Per Session field directly on your Trainer Worksheet form and it will display the correct value (after they are properly related). If there is a possibility of changing anything within a contract and you want any prior Trainer Worksheet records to retain their original value then you will need those fields within Trainer Worksheet.

LaRetta :wink2:

Share this post

Link to post
Share on other sites

Hi LaRetta,

Thank you very much for your response...everything worked out just great! I've also found many of your other posts to be quite helpful.

After looking around at different software options for my business, I decided to try to make something of my own that made sense to me and did what I needed it to do. I've only been at it a week, but with the help I've gotten from reviewing the posts in this forum it's been relatively smooth for this newbie.

Thanks again...I appreciate it!

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

  • Create New...

Important Information

By using this site, you agree to our Terms of Use.