Re: Access Query to request record with date closest to todays dat
From: John Spencer (MVP) (spencer4_at_comcast.net)
Date: 07/29/04
- Next message: Pat hartman: "RE: Confused, crazy, or maybe just plain dumb?"
- Previous message: Douglas J. Steele: "Re: Access 97 date range query"
- In reply to: Pete Sperling: "Re: Access Query to request record with date closest to todays dat"
- Next in thread: Pete Sperling: "Re: Access Query to request record with date closest to todays dat"
- Reply: Pete Sperling: "Re: Access Query to request record with date closest to todays dat"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 29 Jul 2004 18:40:27 -0400
The query grid is a graphic view of SQL that has a section at the bottom (a
grid) of cells.
Field: SomeDate
Criteria: <= Date()
Sort: Descending
Select View: Properties from the menu
Click on the grey area next to the table in the query
In the Top Values property enter the number 1
Add any other fields you want to see. If you want to eliminate ties, then add
additional sort criteria.
Pete Sperling wrote:
>
> I would like to enter the correct info in the criteria section of the query for the field that contains the date. Is this the same as the "query grid" you mentioned?
>
> "John Spencer (MVP)" wrote:
>
> > Probably a TOP Clause.
> >
> > SELECT TOP 1 FieldA, FieldB
> > FROM YourTable
> > WHERE SomeDateField <= Date()
> > ORDER BY SomeDateField, Desc
> >
> > If you are doing this in the query grid, post back and I will try to describe
> > what to do.
> >
> > Pete Sperling wrote:
> > >
> > > I'm using Access 97. What entry do I make in the Criteria section of a query, for a control which only contains dates, so that I only get the record that contains a date in the past which is closest to or equals todays date. Only want the query to return one record.
> > >
> > > Any help greatly appreciated.
> > >
> > >
> >
- Next message: Pat hartman: "RE: Confused, crazy, or maybe just plain dumb?"
- Previous message: Douglas J. Steele: "Re: Access 97 date range query"
- In reply to: Pete Sperling: "Re: Access Query to request record with date closest to todays dat"
- Next in thread: Pete Sperling: "Re: Access Query to request record with date closest to todays dat"
- Reply: Pete Sperling: "Re: Access Query to request record with date closest to todays dat"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|