[AccessD] Calculate Pool Times

DWUTKA at marlow.com DWUTKA at marlow.com
Thu Apr 13 15:54:21 CDT 2006


The only catch would be if it goes past midnight.  If that's the case, just
put an arbitrary date into the time field, say 1-1-1899.  Then when you do
the query, set the start date to 'CurrentDate'-'whatever would take it to
1-1-1899.  However, I doubt you would have a pool hall open 24 hours, so it
may be easier to assign a third 'order' field, which would probably be
easier.

Drew

-----Original Message-----
From: Mark A Matte [mailto:markamatte at hotmail.com] 
Sent: Thursday, April 13, 2006 3:49 PM
To: accessd at databaseadvisors.com
Subject: Re: [AccessD] Calculate Pool Times

Drew,

That is absolutely perfect...I think...at first glance...I don't even have 
to loop through to figure out what price...and this looks like a legitimate 
reason to use a Cartesian join?

Thanks,

Mark




>From: DWUTKA at marlow.com
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: accessd at databaseadvisors.com
>Subject: Re: [AccessD] Calculate Pool Times
>Date: Thu, 13 Apr 2006 15:15:01 -0500
>
>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
>--
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com


-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list