about FW_ADOX_CreateExcelTable() :
i wonder that FW_ADOX_CreateExcelTable() crash at FIELD "MARRIED" which is not 1st or Last FIELD in DBF
Looks like you did not see my working code patiently and jumping at conclusions too fast.
While creating Excel Table, ADOX can not create more than 7 fields at a stretch and the field MARRIED is the 8th field.
That is the reason why I added the table after the 7th field and then continued to add other fields.
This is the important part of the code I posted, dealing with the limitation of 7 fields.
- Code: Select all Expand view RUN
- if i == 7
oCat:Tables:Append( oTable )
oTable := oCat:Tables( cTable )
endif
Please see my full working code again, posted earlier
- Code: Select all Expand view RUN
- function FW_ADOX_CreateExcelTable( oCn, cTable, aStruct )
local oCat := CreateObject( "ADOX.Catalog" )
local oTable, aFld, n, cType
local oCol, oCol2
local nType, nLen
oCat:ActiveConnection := oCn
cTable := Lower( cTable )
oTable := CreateObject( "ADOX.Table" )
oTable:Name := cTable
AEval( aStruct, <|aFld,i|
local nType := ;
If( aFld[ 2 ] == "C", adVarWChar, ;
If( aFld[ 2 ] $ "DT=@", adDate, ;
If( aFld[ 2 ] == "L", adBoolean, ;
If( aFld[ 2 ] $ "+N", adDouble, adLongVarWChar ) ) ) )
oTable:Columns:Append( aFld[ 1 ], nType )
if i == 7
oCat:Tables:Append( oTable )
oTable := oCat:Tables( cTable )
endif
return nil
> )
return nil
Kindly note that whatever code I post in the forums, is only after fully testing at my end. It has to work 100% if used exactly as I posted.