Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text output from a date field in a report? 1

Status
Not open for further replies.

cav

MIS
Feb 3, 2000
49
US
I have a destroy field set up as type :date/time.
I can set up a query to get the destroy dates that are < now and also query the 12/3000 &quot;Never destroy&quot; and the 12/2999 &quot;Don't know&quot; date. How do I get the &quot;Never destroy&quot; and the &quot;Don't know&quot; to show up as text on a report. Be kind, I do not program. Thank you so so much.

 

You can use the SWITCH function in a query, on a form or in a report.

txtDestroyDate = Switch([DestroyDate] < Date, Format([DestroyDate], &quot;mm/yyyy&quot;), Format([DestroyDate], &quot;mm/yyyy&quot;) = &quot;12/3000&quot;, &quot;Never Destroy&quot;, Format([DestroyDate], &quot;mm/yyyy&quot;) = &quot;12/3000&quot;, &quot;Don't Know&quot;) Terry
------------------------------------
Blessed is the man who, having nothing to say, abstains from giving us worthy evidence of the fact. -George Eliot
 
This worked fine...and report output was just what I needed. THANK YOU...but it made me think of a more user friendly way of approaching this field. On the form, I'd like the user to type &quot;Never destroy&quot; or &quot;Don't know&quot; or a date...then have this info changed to a date in a date field so I can query < now. Or is there a better way to approach this? Thanks so, so much. I'm learning a lot!
CAV
 
I have the &quot;Never Destroy&quot; switching to 12/3000 and &quot;Don't know&quot; switching to 12/2999 but I need help with the date appearing in the field.
I used the following switch function in a query: Expr1: Switch([DestroyDate]=&quot;mm/yyyy&quot;,&quot;mm/yyyy&quot;,[DestroyDate]=&quot;Never Destroy&quot;,&quot;12/3000&quot;,[DestroyDate]=&quot;Don’t Know&quot;,&quot;12/2999&quot;). Please help. Thank You.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top