Aircode:
Select [shipdate], IIf([shipdate]<Date(),"Backordered",[shipdate]) As Status
From MyTable
Order By IIf([shipdate]<Date(),"Backordered",[shipdate]) Desc;
Should put Backordered to the top and the other dates in descending order
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
Arvin,
Woudld it not be necessary to convert the date to a string to use for
sorting and grouping when you have a string value to include in the field?
Even if the date were coersed into a string automatically, the sorting
would
be not be truely by date (assuming crossing of year boundries) and
"Backordered" would sort to the bottom. To put "Backordered" at the top
and
sorty by date, I would make the calculated field like this:
Status: IIF ([shipdate]<date(), " ", Format([shipdate],"yyyymmdd")
The values in the calculated field don't have to be displayed anywere, so
dummying it up like that has no effect on what the user sees, but does
control the sorting like you want it.
--
Dave Hargis, Microsoft Access MVP
:
Your problem is that you wrote it in the ship date field. Add a new
column
(called an alias column) something like:
Status: IIF ([shipdate]<date(), "Backordered", [shipdate])
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
I have an order schedule report that is sorted and grouped by ship date.
I
want any orders dated before today to show up grouped under a
"Backorder"
heading and anything else to show up grouped under its ship date. Is
there
a
way to write an IF statement in the control source box of the ship date
field
to make that happen?
I tried this: IIF ([shipdate]<date(), "Backordered", [shipdate]). It
says
there's a syntax error.
Thanks!