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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Switch function on the fritz...

Status
Not open for further replies.

JJman

Technical User
May 8, 2003
89
IN

I have "the mother of all Switch functions" (shown below) which, except for the last line is working perfectly. The last line has "Please email us immediately if you find any discrepancies", but the value that is being returned is "Plea0e e11ail u0 i11e1iatel305 if 305ou fi01 a0305 1i011/1/2003rep". Any idea what could cause this? Thanks!


CompletionListType: Switch(DateDiff(&quot;m&quot;,Date(),[Completion_Date])<0,&quot;Completion documentation overdue! Please send final letter, photo and update.&quot;,DateDiff(&quot;m&quot;,Date(),[Completion_Date])<2,&quot;Completion documentation due. Please send final letter, photo and update.&quot;,DateDiff(&quot;m&quot;,Date(),[Completion_Date])<8,&quot;Completion communication in process&quot;,DateDiff(&quot;m&quot;,Date(),[Completion_Date])<10,&quot;Confirm completion date by &quot; & Format$(DateAdd(&quot;m&quot;,-7,[Completion_Date]),&quot;mmm&quot; & &quot; d&quot; & &quot;, &quot; & &quot;yyyy&quot; & &quot;. Please email us immediately if you find any discrepancies.&quot;))


 
Well, I ran your Switch function and had a couple problems but not the one you mention. First, I had to add a trailing &quot;)&quot; for the Format$ function after the &quot;yyyy&quot; and lose a &quot;)&quot; at the end of the Switch function. The second problem may just be related to your [Completion Date] field. When I ran it as it was and inserted a date of #1/1/03#, it returned -9 so the first argument always returned true. If your [Completion Date] is in the future then your switch should run with just the change in closing &quot;)&quot;. I ran fine after I made the adjustments.

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top