Getting Query Info only

  • Thread starter Thread starter Kelly
  • Start date Start date
K

Kelly

I have a query which gets information from my [Tbldata].
It is set up to give me the last two records of those
requested and would look like this

DataID FilterName RowNumber SectorNumber Date
46 #1 Zinc 03 05 10-Jan-04
22 #1 Zinc 03 05 2-Jan-04

I need to get the DateDiff (or number of days) between
these two dates which could be 20 records apart in the
underlying table. I have a Module that finds
the 'PrevRecVal' based in the [ID]. This however, picks up
the the next value in the table. I need to work with only
the dates that appear in the query. There is only one date
field in the database as only the change date is required.
Any insights as to how to do this would be appreciated.
Thanks.....kbe
 
Kelly,

Maybe I'm missing something here... why can't you just base your
request on the query you have already created?
Interval: Max([YourDate])-Min([YourDate])

By the way, as a side issue, the word Date has a special meaning in
Access - it is called a 'reserved word' - and as such, it is not a
good idea to use is as the name of a field or control or database
object.

- Steve Schapel, Microsoft Access MVP
 
Thanks for the reply Steve, when I enter that into the
query I get "you tried to execute a query that doesn't
include the specified expression 'DataID' as part of an
aggregate function. While I can work with macros etc. this
part of Access still bewilders me. As for the [Date] I am
now aware of its reserved state but to change now would
mean reworking 40 queries and reports that currently work
fine. Since it is the only {Date] entry in the database
hopefully we can get away with it. Thanks again.....Kelly
-----Original Message-----
Kelly,

Maybe I'm missing something here... why can't you just base your
request on the query you have already created?
Interval: Max([YourDate])-Min([YourDate])

By the way, as a side issue, the word Date has a special meaning in
Access - it is called a 'reserved word' - and as such, it is not a
good idea to use is as the name of a field or control or database
object.

- Steve Schapel, Microsoft Access MVP


I have a query which gets information from my [Tbldata].
It is set up to give me the last two records of those
requested and would look like this

DataID FilterName RowNumber SectorNumber Date
46 #1 Zinc 03 05 10-Jan- 04
22 #1 Zinc 03 05 2-Jan- 04

I need to get the DateDiff (or number of days) between
these two dates which could be 20 records apart in the
underlying table. I have a Module that finds
the 'PrevRecVal' based in the [ID]. This however, picks up
the the next value in the table. I need to work with only
the dates that appear in the query. There is only one date
field in the database as only the change date is required.
Any insights as to how to do this would be appreciated.
Thanks.....kbe

.
 
Kelly,

Sorry to be unclear. I did not mean to put that expression into the
existing query. I meant to make a new query, based on the existing
query, and that's where you would work in out.

- Steve Schapel, Microsoft Access MVP
 
Steve,
What would a specified expression 'FilterName' look like
in Max([YourDate])-Min([YourDate])? I have been trying
everything I can think of but keep comming up with the
gray box. Thanks for your patience....Kelly
-----Original Message-----
Kelly,

Sorry to be unclear. I did not mean to put that expression into the
existing query. I meant to make a new query, based on the existing
query, and that's where you would work in out.

- Steve Schapel, Microsoft Access MVP


Thanks for the reply Steve, when I enter that into the
query I get "you tried to execute a query that doesn't
include the specified expression 'DataID' as part of an
aggregate function. While I can work with macros etc. this
part of Access still bewilders me. As for the [Date] I am
now aware of its reserved state but to change now would
mean reworking 40 queries and reports that currently work
fine. Since it is the only {Date] entry in the database
hopefully we can get away with it. Thanks again.....Kelly

.
 
Back
Top