DWUTKA at marlow.com
DWUTKA at marlow.com
Thu Apr 13 15:15:01 CDT 2006
Why not make it easier on yourself, and create a table based on minutes. If it's $3 an hour from 1600 to 1659, that's 60 minutes, thus $.05 a minute. Why not create a table that like 1600 .05 1601 .05 1602 .05 .... 1700 0 1701 0 .... 2000 .025 2001 .025 2002 .025 .... 2200 .05 2201 .05 Etc. Then, to calculate how much someone owes, you create a query that includes all of the 'minutes' played, and do a sum on the charge field. Whalla. It would be pretty easy to 'populate' such a table from a nice form that would allow for new 'specials'. Drew -----Original Message----- From: Mark A Matte [mailto:markamatte at hotmail.com] Sent: Thursday, April 13, 2006 1:46 PM To: accessd at databaseadvisors.com Subject: [AccessD] Calculate Pool Times Hello All, I need some help with my logic here. The app will track how long some one is on a pool table and charge accordingly. I want to have the specials calculate automatically. For example: Someone shoots from 16:00 to 23:00. The normal rate is 3dph. From 17:00 to 19:00 is free and from 20:00 to 22:00 is 1.5dph. These are only the specials today...there might only be one tomorrow. I started with a specials table that would have the day,start,end, and rate. Each special is its own record. In the end it would charge: 16:00-16:59 3$ 17:00-18:59 0$ 19:00-19:59 3$ 20:00-21:59 1.5$ 22:00-23:00 3$ I guess I could loop through minute by minute and compare the time to the each special... and sum that way...but that didn't seem right? Any ideas/suggestions on an approach would be greatly appreciated. Thanks, Mark A. Matte -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com