Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Queries / November 2005

Tip: Looking for answers? Try searching our database.

Retrieve all records for 30 max dates

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
goofy11 - 04 Nov 2005 17:44 GMT
I posted a question last week that I thought was satisfactorily answered,
until I did some further testing.  After reviewing the results, I can see I
was not 100% clear in my question.  Here's what I'm after:

I have a basic table with product data listed by day.  This table will
continue to grow every day since I will append each new day's data to the
table.  (BUT, there is the possibilty of missing dates.  For instance, I
have historical data with no data for weekends.)  Here is an example of what
I want to do:

Let's say I've got 60 days worth of data (60 unique dates), but with
periodic missing dates.  What I want in my query results are all the records
for the 30 most recent days (or 30 max dates).  How can I do this?  My table
is set up similar to this:

Item #            Instock           Date
23456             99.5%            10/27/2005
etc.                 etc.                etc.

The response listed below got me close, but with the missing dates it
returned less than 30 dates.

-----------------------------------------------------------------------------------------------------------
Try this, filtering on the last date - 10 days

Select TableName.* From TableName Where [Date] > = (select Max([date]) From
TableName) - 10

One more thing, if the field name is date it can cause some problem because
date is a resurve name in Access
Signature

If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck

Sheila D - 04 Nov 2005 18:12 GMT
You could set up a Totals query which just contains the Date field as Group
By then set Top Values property to 30

Link this query to your table with a relationship on the date field and it
should pull out all the records for the dates in Query1

Hope this helps

Sheila

> I posted a question last week that I thought was satisfactorily answered,
> until I did some further testing.  After reviewing the results, I can see I
[quoted text clipped - 26 lines]
> One more thing, if the field name is date it can cause some problem because
> date is a resurve name in Access
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.