I have a query:
SELECT tblCalendar.CalendarDay AS LastSunday
FROM tblCalendar
WHERE (((tblCalendar.CalendarDay)>=(Now()-7) And (tblCalendar.CalendarDay)
<DateAdd("d",8-Weekday((Now()-7),2),(Now()-7))) AND ((tblCalendar.Weekday)=1))
;
tblCalendar is a table of consecutive dates from 1998 thru 2020. It has
proven useful in many applications. CalendarDay is the date. The code above
returns the date of the Sunday preceding the day on which the query is run,
based on the system date. I had hoped to use this value in place of a prompt,
[Current WE Date], in an expression in a query field that looks like this:
IIf([Current WE Date]>=[Week Ending]![Week-end Date] And [Week Ending2]![Week-
end Date2] Is Null,"Not Yet Released RED","Planned Not Yet Released")
This query looks to another calendar table ([Week Ending]) which I would
dearly love to retire. This table has a field of consecutive dates and a
field of corresponding WE dates for each date. It is joined by the
consecutive date field in a query to a date field in a data table and the
corresponding WE date is determined from that.
Dates always confound me anyway, but can anyone see anyway I can use
LastSunday in place of the prompt? I already tried just replacing the prompt
with the LastSunday field, but I suspect there's a problem with the join.
There ought to be some way to replace a prompt for the date with the very
date the prompt is looking for as delivered by my LastSunday query, but I'll
be damned if I can figure it out!
--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200507/1