Sergey,
Thanks again for your input. It's always nice to hear from you.
>Yes, it'll work because you're adding integer type column which is VFP specific.
Exactly!
> However the table will be copied twice, once per each ALTER TABLE.
Yes, I know, but I'd rather let VFP do it. It's less messy for me! :)
And actually, I don't think it did the copy the first time. I tried without changing anything, just issueing the ALTER COLUMN command on the first Character field I found, and giving it the existing properties, and it didn't change the file type, it was still a type "3". That's why I decided to add and remove the Integer field. I KNEW that would force it to a VFP type table.
>BTW, you don't have to use macro substitution. The name expression is faster and more readable.
ALTER TABLE (lcTableName) ADD COLUMN TestInt I
Thanks for reminding me. I will make that change before I run it.
Take care, Sergey.
>
>>Thanks, Sergey. But I had a thought about ALTER TABLE and just figured out a way. As a test I ran this code:
>
>>lnTableCount = ADIR(laTables, '*.DBF')
>>
>>FOR lnLooper = 1 TO lnTableCount
>> lcTableName = ALLTRIM(laTables[lnLooper, 1])
>> USE (lcTableName) EXCLUSIVE
>> lnTableType = SYS(2029)
>> IF lnTableType = '3' OR lnTableType = '245'
>> WAIT WINDOW 'FoxPro 2.6 type table found! Table: ' + lcTableName
>> = AFIELDS(laFields)
>> lnRow = ASCAN(laFields, 'C', -1, -1, 2, 10)
>> lcFieldName = ALLTRIM(laFields[lnRow, 1])
>> lnFieldSize = laFields[lnRow, 3]
>> lcAlterCommand = 'ALTER TABLE ' + lcTableName + ' ADD COLUMN TestInt I'
>> &lcAlterCommand
>> lcAlterCommand = 'ALTER TABLE ' + lcTableName + ' DROP COLUMN TestInt'
>> &lcAlterCommand
>> EXIT
>> ENDIF
>>ENDFOR
>
>>That worked. So I can remove the EXIT command and just let her rip!
>>I guess I should have tried that before asking. But there was always the off chance that there was a simple function that I was unaware of.
>>
Where's the damned Any Key?...too late