Here is an alternative to your code. It is a function that returns a
logical true or false if the field 'Fname' is in table 'Tabname'.
function FieldPresent(TabName as string, byval Fname as string) as
logical
dim i, TabCols as smallint
TabCols = tableinfo(TabName, TAB_INFO_NCOLS)
FieldPresent = false
for i = 1 to TabCols
if columninfo(TabName, "col"+i, COL_INFO_NAME) = Fname then
FieldPresent = true
exit for
end if
next
end function
-----Original Message-----
From: Fran�ois Molle [mailto:[EMAIL PROTECTED]]
Sent: Thursday, July 06, 2000 7:21 AM
To: MAPINFO-L
Subject: MI MB: how to check if column XXX exists in table TTT
Dear All
Apparently, there are no function to know if column XXX exists in table
TTT (is there ?)
So I built a loop on all columns name to check whether one is equal to
XXX.
TTT as Alias, tesname as string
For i=1 to Nbcolumn
testname=ColumnInfo(TTT,"col"+str$(i),COL_INFO_NAME)
If testname=TTT then print "OK" end if
next
For some reason, it does not accept this and gives the error:
"Variable or Field TTT not defined"
Is it because of the mismatch of variables, String and Alias ?
If I use testname=str$(TTT) is does not work either.
Thanks for any help to draw me out of this deadlock...
Francois
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]
----------------------------------------------------------------------
To unsubscribe from this list, send e-mail to [EMAIL PROTECTED] and put
"unsubscribe MAPINFO-L" in the message body, or contact [EMAIL PROTECTED]