>If you have a field name and want to find which table it's in quickly and efficiently, is there anything better than the following:
>
>SELECT table1
>=AFIELDS(aArray1)
>FOR i = 1 TO ALEN(aArray1,1)
>IF myfield = aArray1(i,1)
>itsintable1 = .T.
>ENDIF
>IF itsintable1 = .T.
>SELECT table2
>=AFIELDS(aArray2)
>FOR i = 1 TO ALEN(aArray2,1)
>IF myfield = aArray2(i,1)
>itsintable2 = .T.
>ENDIF
>
>...or is this what I have to do, unless I work around it?
Your code is OK (may be it's nicer to use ASCAN() to scan array), but there is no limit of handling data-related problems in VFP. Next code is just a joke:
lErrorflag=.F.
ON ERROR lErrorflag=.T.
SELECT table2.myfield From table2 Into ...
ON ERROR
IF lErrorflag=.T.
=messagebox("No such field!")
ELSE
=messagebox("Yes, you got it!")
ENDIF
Edward Pikman
Independent Consultant