Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

transfer sum() to field

transfer sum() to field

transfer sum() to field

I have a database(Foxpro Win2.6) which has patient charges and pmts in "fee" field. Their account numbers are in field "acc_num". Some patients have only a few entrys,and others have several. I have a field named "balance",which I have been trying to place the sum() of each "fee" for each patient,but can't seem to get it right. Will appreciate any help I can get. Thank you in advance !

RE: transfer sum() to field

I am not sure if I got your question correct or not...Here is my solution according to what I understood:
First you have to filter the data of each account number (of each patient) through either set filter to in the same table , or through Select SQL into a temporary table after assigning a select area for it (this is faster than set filter to). Now you will have all the data from all the fields for this particular patient. Then use calculate sum((charges field number 1)+(charges field number 2+...etc)) to a memory variable (e.g. sum_fees). If you plan to have the total charges for each patient regardless of the dates of his visits, then create a separte table that refers to this particular patient either through his file number or account_number with a field named e.g. Total_fees. Now after getting the sum_fees from first table, open the second table through another select area and replace the field Total_fees with the memory variable sum_fees. Of course the memory variable has to be Public variable. If you want to calculate charges for the patient of his current visit, then you have to filter the data according to the date of each visit.
I hope this answers the question.
Dr. Qasem Alsaleh

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close