SELECT cname, tdatetime, ; IIF(EMPTY(cPickup), cPaddr, cPickup) AS cPickup, ; IIF(EMPTY(cDropoff), cDaddr, cDropoff) AS cDropoff, ; IIIF(cStatus, "CXL", "NR", "NS", "Canceled", "Not Ready", "No Show") AS cstatus ; FROM Trip_History ; INTO CURSOR vtrips ; WHERE (INLIST(cStatus, "CXL", "NR", "NS")) AND BETWEEN(TTOD(tdatetime), pdBegin, pdEnd) ; ORDER BY cStatus, tdatetime"IIIF()" is a function I made that returns one of the last three options. VFP is giving me a "data type mismatch" error on the IIIF line. I've used UDFs in SQL before without a problem, and I think I might have used this IIIF() before. I don't understand why it's giving me an error. IIIF.prg is in the path, so I know it can find it. And the function works on its own.