Now, I had codes that does create the table w/o errors. My problem is with the numeric fields(adinteger, adnumeric, addecimal, etc.). I can't set the width and the decimal places of the fields, even though I've tried setting the Precision, NumericScale, and DefinedSize with their corresponding data types. It does create the table with these fields, but in Foxpro 2.5, the datatype is Numeric; width=20; dec=5. Do you have any ideas on how to manipulate the width and dec places when creating a dbase III table? If you have, I will greatly appreciate it. Thanks in advace!
Below are the codes:
Expand|Select|Wrap|Line Numbers
- Global tbl As New ADOX.Table
- Global cat As New ADOX.Catalog
- Public Sub createtable()
- cat.ActiveConnection = _
- "Provider=Microsoft.Jet.OLEDB.4.0;" & _
- "Data Source=" & pathcdate & ";" & _
- "Extended Properties=dBase III;"
- tbl.Name = collfilename
- tbl.Columns.Append "CDATE", adDate
- tbl.Columns.Append "ID", adNumeric
- tbl.Columns.Append "BATCH", adVarWChar, 4
- tbl.Columns.Append "MNTHEFF", adInteger, 3 'NO EFFECT: STILL, WIDTH=20 AND DEC=5
- tbl.Columns.Append "POSTED", adBoolean, 1
- With tbl.Columns.Item("ID")
- .ParentCatalog = cat
- .Precision = 5
- .NumericScale = 0 'THE CREATED TABLE IN FOXPRO SAVED THE WIDTH=20 AND DEC=5
- End With
- cat.Tables.Append tbl
- End If
- End Sub