Question With A Expression

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I would like to write an expression base on the following information.
I have query that was ran and it gave me a list of information, there are
several fields which include the date of when the information was entered
[DATE], a number of hours that took do a job[HOURS]. What I would like to do
is write an expression that will add the hours until a total of 20 hours have
been achieved and then give me the corresponding date from the date field
[DATE].

I hope I have made some sense of this. Any help would be greatly appreciated.

Thank you,
Lee
 
Lee said:
I would like to write an expression base on the following information.
I have query that was ran and it gave me a list of information, there are
several fields which include the date of when the information was entered
[DATE], a number of hours that took do a job[HOURS]. What I would like to do
is write an expression that will add the hours until a total of 20 hours have
been achieved and then give me the corresponding date from the date field
[DATE].

I hope I have made some sense of this. Any help would be greatly appreciated.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You don't make complete sense since you stated that the query is already
returning the Date, but you want it to return the Date when 20 hrs is
reached. Return the Date 2 times?

Generally, what you are asking for is called a running sum query. Here
is a site that explains how to create such a query:

http://support.microsoft.com/default.aspx?scid=kb;en-us;205183

====

Do you mean that you want a result set like this:

Date Hours
---- -----
5/1/05 20
5/15/05 20

which means the hours worked on the dates prior to 5/1/05 totaled 20 on
5/1; and, the hours worked on the dates after 5/1 and up to 5/15 totaled
20 hours. Is this what you want? If so, right off the top of my head
it seems to be a looping process rather than a query process. IOW, read
in the recordset for all dates & hours. Iterate thru each record adding
the hours. When 20 hours is reached display the date and reset the
hours count to zero. Continue reading the records until the next 20
hours date is reached, etc. There may be someone other than me, who is
more competent in set theory, that can create a query to do this.
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQnKW3IechKqOuFEgEQL6GwCgvDGEwT2Y4IhVhcGJh2NdjjSjuBQAn1UA
NG7S4i4baGmIh8MnzSXQzQDF
=jslT
-----END PGP SIGNATURE-----
 
Back
Top