Hi experts, I've tried using DAO and ADOX to create dbase tables from VB6. The problem with these is that I can't manipulate the width and decimal places of the fields with a numeric data type. I guess, this is because "Jet DB engine that
VB uses tends to translate field types and sizes into what it 'thinks' are correct for a field", as stated from a post.
So I'm trying to create tables directly in Foxpro 2.5 from VB6 using the codes below:
Code:
Global fx As New FoxApplication
Set fx = Nothing
fx.OleRequestPendingTimeout = 900000
fx.OleServerBusyTimeout = 900000
fx.DefaultFilePath = LPath
fx.DoCmd "CLOSE DATABASES"
fx.DoCmd "USE customer.dbf"
fx.DoCmd "COPY STRUCTURE TO TEST"
fx.DoCmd ("USE")
Also this,
Code:
fx.DoCmd ("CREATE TABLE TEST.dbf (FNAME C(12))")
The program runs w/o errors, and I can also see from the files that the table TEST.dbf is created. But I can't open it in Foxpro. The error says, "Not a Database file".
I have also tried using the SQL statement:
Code:
rs.open "CREATE TABLE TEST (col1 char(6), col2 int(2))", conn, adOpenStatic, adLockOptimistic, adCmdText
which displays the same error from Foxpro 2.5.
I've also searched from the net about this error and had found some codes that checks and repairs the no. of records in the header. Still, to no avail. If you want to see the codes I found, I'll post it here. It's kinda long.
Please, if anyone has some ideas about this, kindly share it to me.. Please shed some light..
Or if there are other solutions on how to create dbase III tables from vb6 (where I can manipulate the width and decimal places of the numeric fields), please post it here.. Thank you all in advance!