A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Most Recent Date



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2004, 05:55 PM
Michael Noblet
external usenet poster
 
Posts: n/a
Default Most Recent Date

I have a linked table that has 3 fields.
fldName
fldHours
fldDate

This table is poulated by and external program designed to
give hours of usage by month and is run to show the most
recent month and the previous month's data.

Therefore the Date field only has 2 values:
03/01/04 and 04/01/04. this would be for april and
march's figures. Next month the table will be repopulated
with April and may (04/01/04 and 05/01/04).

without specifying a date as criteri in the query how can
I get only the current month's data?
  #2  
Old May 27th, 2004, 06:24 PM
hcj
external usenet poster
 
Posts: n/a
Default Most Recent Date

I tried this and it seems to work on a small data set:
build a second Totals query that simply finds the Max date
in your basic data set. Join this query into your main
query via the date field (join for exact matches only).
The main query will only pull records whose dates match
the max date.
HTH

-----Original Message-----
I have a linked table that has 3 fields.
fldName
fldHours
fldDate

This table is poulated by and external program designed

to
give hours of usage by month and is run to show the most
recent month and the previous month's data.

Therefore the Date field only has 2 values:
03/01/04 and 04/01/04. this would be for april and
march's figures. Next month the table will be

repopulated
with April and may (04/01/04 and 05/01/04).

without specifying a date as criteri in the query how can
I get only the current month's data?
.

  #3  
Old May 27th, 2004, 06:28 PM
Gerald Stanley
external usenet poster
 
Posts: n/a
Default Most Recent Date

Use a WHERE clause along the lines of

WHERE fldDate IN (SELECT Max(fldDate) FROM YourTable)

Hope This Helps
Gerald Stanley MCSD
-----Original Message-----
I have a linked table that has 3 fields.
fldName
fldHours
fldDate

This table is poulated by and external program designed to
give hours of usage by month and is run to show the most
recent month and the previous month's data.

Therefore the Date field only has 2 values:
03/01/04 and 04/01/04. this would be for april and
march's figures. Next month the table will be repopulated
with April and may (04/01/04 and 05/01/04).

without specifying a date as criteri in the query how can
I get only the current month's data?
.

  #4  
Old May 27th, 2004, 06:28 PM
Cheryl Fischer
external usenet poster
 
Posts: n/a
Default Most Recent Date

Try this:

1. Add the following to the Field: row in a new column in your query's
design:

Month([fldDate])

2. In the Criteria: row for that column, add the following:

Month(Date())



hth,
--

Cheryl Fischer, MVP Microsoft Access



"Michael Noblet" wrote in message
...
I have a linked table that has 3 fields.
fldName
fldHours
fldDate

This table is poulated by and external program designed to
give hours of usage by month and is run to show the most
recent month and the previous month's data.

Therefore the Date field only has 2 values:
03/01/04 and 04/01/04. this would be for april and
march's figures. Next month the table will be repopulated
with April and may (04/01/04 and 05/01/04).

without specifying a date as criteri in the query how can
I get only the current month's data?



  #5  
Old May 27th, 2004, 08:19 PM
external usenet poster
 
Posts: n/a
Default Most Recent Date

Cheryl,
Wouldn't this come up empty if the query runs in a
month later than the latest data month (and even then,
assuming that the computer clock is correct)? E.g.:
running the March-April data in May, or running the April-
May data in June.
Would appreciate your take on my original reply; I
tested on a a very small sample, but may have overlooked
something.
Respecfully, hcj

-----Original Message-----
Try this:

1. Add the following to the Field: row in a new column

in your query's
design:

Month([fldDate])

2. In the Criteria: row for that column, add the

following:

Month(Date())



hth,
--

Cheryl Fischer, MVP Microsoft Access



"Michael Noblet"

wrote in message
...
I have a linked table that has 3 fields.
fldName
fldHours
fldDate

This table is poulated by and external program designed

to
give hours of usage by month and is run to show the most
recent month and the previous month's data.

Therefore the Date field only has 2 values:
03/01/04 and 04/01/04. this would be for april and
march's figures. Next month the table will be

repopulated
with April and may (04/01/04 and 05/01/04).

without specifying a date as criteri in the query how

can
I get only the current month's data?



.

  #6  
Old May 28th, 2004, 01:16 AM
Cheryl Fischer
external usenet poster
 
Posts: n/a
Default Most Recent Date

Yes, it would. If you want to run the query in some month later than the
two months contained in your table, use a parameter in the Criteria: row

[Enter month number to find:]

This will cause a prompt which will allow you or your users to enter the
desired month.

--

Cheryl Fischer, MVP Microsoft Access



wrote in message
...
Cheryl,
Wouldn't this come up empty if the query runs in a
month later than the latest data month (and even then,
assuming that the computer clock is correct)? E.g.:
running the March-April data in May, or running the April-
May data in June.
Would appreciate your take on my original reply; I
tested on a a very small sample, but may have overlooked
something.
Respecfully, hcj

-----Original Message-----
Try this:

1. Add the following to the Field: row in a new column

in your query's
design:

Month([fldDate])

2. In the Criteria: row for that column, add the

following:

Month(Date())



hth,
--

Cheryl Fischer, MVP Microsoft Access



"Michael Noblet"

wrote in message
...
I have a linked table that has 3 fields.
fldName
fldHours
fldDate

This table is poulated by and external program designed

to
give hours of usage by month and is run to show the most
recent month and the previous month's data.

Therefore the Date field only has 2 values:
03/01/04 and 04/01/04. this would be for april and
march's figures. Next month the table will be

repopulated
with April and may (04/01/04 and 05/01/04).

without specifying a date as criteri in the query how

can
I get only the current month's data?



.



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:54 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.