Re: Nearest max date before a specified one



SELECT Top 1 dEntryDate
FROM R tblDates
WHERE dEntryDate<CDate('1.1.2005')
ORDER BY dEntryDate Desc;


--
Duane Hookom
MS Access MVP


"Frank" <frank673@xxxxxxxxxxx> wrote in message
news:Oq%23S59DdFHA.612@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> I am trying to create an SQL statement which would return to me the
> maximum date before a specified date. I was able to get a list of records
> with dates prior to the one I enter but not the last one. Can anyone help?
> Thanks.
>
> SELECT tblDates.dEntryDate
> FROM R tblDates
> WHERE (((tblDates.dEntryDate)<CDate('1.1.2005')));
>
> Frank
>
>
>


.



Relevant Pages

  • Re: validation in pass through query
    ... Assuming you have two text boxes on your form: ... Create a table in your back-end database "tblDates" with two date fields ... Duane Hookom ... >> MS Access MVP ...
    (microsoft.public.access.queries)
  • Re: Counting days in a crosstab query
    ... FROM tblDates ... which type of query are you using? ... >> Duane Hookom ... >> MS Access MVP ...
    (microsoft.public.access.reports)
  • Re: How to summarize records on one page?
    ... The query that I am suggesting doesn't have a join between the query and ... Duane Hookom ... MS Access MVP ... I have to create a link between the tblDates and the query so I ...
    (microsoft.public.access.reports)
  • Re: Counting days in a crosstab query
    ... How would those two fields fir into the sql statement you created. ... "Duane Hookom" wrote: ... > The SQL view of the query should be: ... > FROM tblDates ...
    (microsoft.public.access.reports)