ThomaStudios Posted January 12, 2007 Posted January 12, 2007 I have a database for a private music teacher and we're trying to have it automatically keep track of lesson charges based on the number of students in each family, the length of the lessons, and the charge per lesson at a rate per half hour. I've been using simple calculations that work fine if each lesson is the same length. Now we're having to deal with lesson lengths that can vary from student to student, either 30, 45, or 60 minutes. I've set up a field for the lesson length formatted as radio buttons with each one of these values and I'm trying to complete a calculation based on these fields: Count - the number of students in the family Lesson Length - 30, 45, or 60 minutes Lesson Charge per half hour This would seem to be a good place to use the Choose function, or perhaps the Case function, but nothing I do will return the calculation based on changes to the Lesson Length field. I either get no result, or there is no change if I switch the Length buttons. I'm sure it's probably a very simple oversight on my part. Here is the formula I've been working with: Choose ( Lesson Length = 30 ; Count * Lesson Chg * 1 ; Lesson Length = 45 ; Count * Lesson Chg * 1.5 ; Lesson Length = 60 ; Count * Lesson Chg * 2 ) Any help is greatly appreciated.
Fitch Posted January 12, 2007 Posted January 12, 2007 Your formula will work fine if you use Case instead of Choose.
mr_vodka Posted January 12, 2007 Posted January 12, 2007 If it will always be increments of 15 minutes, 15, 30, 45, 60, 75, 90, etc then it may be better if you use a simple calc like this: Lesson Length / 30 * Count * Lesson Chg or Div ( Lesson Length; 15) * Count * ( Lesson Chg / 2 ) will charge in increments of 15 minutes. So, 40 minutes & 44 mins will still be charged at 30 minutes. Only when it hits 45 minutes will it charge for 45 minutes.
Fitch Posted January 12, 2007 Posted January 12, 2007 I just noticed that after I posted, but you beat me to it. Nice one.
ThomaStudios Posted January 12, 2007 Author Posted January 12, 2007 Unfortunately, I did that earlier, and just now after reading your post, and the result is a blank field. Nothing. Is there some slight syntax error I'm missing? J D Thomas ThomaStudios
ThomaStudios Posted January 13, 2007 Author Posted January 13, 2007 Aha. First off, thank you for the great suggestions. I was dealing with an mistake on my part that I didn't realize until this morning. For some stupid reason I had the Lesson Chg field formatted as a repeating field, which was totally unneccessary. All the suggestions are working fine now. Plus, I learned something. Thanks again. J D Thomas ThomaStudios
Recommended Posts
This topic is 6585 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now