Hi Brent,
Assuming that c_ordrcode and o_rec_id are the same data type (char?)......
IIF(TYPE("c_ordrcode")="C",c_ordrcode,o_rec_id)
>I wanted to use an IIF() but wasn't sure how to make the IIF() search the table to see if a field is located in it. When I say field, I mean field name, the entire column. I am doing the search for the field like this.
>
>COPY STRUCTURE EXTENDED TO holdtbl
> SELECT 0
> USE holdtbl
> SELECT holdtbl
> SCAN
> IF(holdtbl.field_name = "c_ordrcode")
> lcorder = "c_ordrcode"
> ELSE
> lcorder = "O_rec_id"
> ENDIF
> ENDSCAN
> drop table holdtbl
>
>So if C_ordrcode is in the table then I want the c_ordercode printed, otherwise I want the O_rec_id printed.
>
>See what I mean?
------------------------------------------------
John Koziol, ex-MVP, ex-MS, ex-FoxTeam. Just call me "X"
"When the going gets weird, the weird turn pro" - Hunter Thompson (Gonzo) RIP 2/19/05