My goal is to determine under what conditions, if any, is it wise to OrderBy a calculated field. Below is a task I'm faced with that lead to me pondering this.
I have an "Orders" Table which has an OrderStatus field (acceptable values are: 'Pending', 'In Production', 'Ready', 'Shipped'). Part of me wants to make that field a "Short Text" field, with a Field Size of a dozen or so characters to store the values, and move on with life. But then I got around to thinking: This table also has a series of timestamp fields (date/time) for each stage of manual labor involved in Order creation - so I could just make OrderStatus a Calculated field like so...
IIf(Not Is Null([DateShipped]), "Shipped", IIf(Not IsNull([DateFinished]), "Finished", IIf(.........))))))))
As you can see, all this is doing is detecting the presence of a value in timestamp fields within the record, and deciding the appropriate string via IIf() nesting.
But what about in a table with a few thousand records? If I wanted to OrderBy that calculated field, wouldn't Access then have to work MUCH harder to precalculate all those values for each record before it could even begin the sort, thus making it crazy slow?!
Thank you for any suggestions.