wwc_um
February 22nd, 2000, 09:33 PM
I have few questions to ask regarding the database in VB. The code below is creating a database(Passive.mdb) with table Tbl.
Set WsPassive = DBEngine.Workspaces(0)
Set DbPassive = WsPassive.CreateDatabase("C:\Passive.mdb", dbLangGeneral)
Set Tbl = DbPassive.CreateTableDef("Tbl")
With Tbl
.Fields.Append .CreateField("NounCode", dbText, 8)
.Fields.Append .CreateField("FirstRec", dbInteger, 8)
.Fields.Append .CreateField("NumRecs", dbInteger, 8)
End With
DbPassive.TableDefs.Append Tbl
Question:
1. I only can create .mdb file with all the table in it with the above code, but how can I read .dbf files and append the results to another file with .010 extension and index file with .101 extension?
2. How can I open 25 .dbf tables, let say psmain01.dbf, psmain02.dbf ....psmain25.dbf and try to do some algorithm for the 25 tables one at a time and then, the output of the records append to a table in a filename, let say Tbl.010?
3. How can get the data value in psmain tables for a particular field and then the generated data append to a table in a filename, let say Tbl.010?
Draft of my pseduocode
Using a 'FOR' loop
Open table psmain01.dbf in an array type
while !eof
Read data from a particular field
do some algorithm to generate some results
skip next record
append the output to a table in a filename
create an index for a particular field
Repeat procedure for 25 times
Set WsPassive = DBEngine.Workspaces(0)
Set DbPassive = WsPassive.CreateDatabase("C:\Passive.mdb", dbLangGeneral)
Set Tbl = DbPassive.CreateTableDef("Tbl")
With Tbl
.Fields.Append .CreateField("NounCode", dbText, 8)
.Fields.Append .CreateField("FirstRec", dbInteger, 8)
.Fields.Append .CreateField("NumRecs", dbInteger, 8)
End With
DbPassive.TableDefs.Append Tbl
Question:
1. I only can create .mdb file with all the table in it with the above code, but how can I read .dbf files and append the results to another file with .010 extension and index file with .101 extension?
2. How can I open 25 .dbf tables, let say psmain01.dbf, psmain02.dbf ....psmain25.dbf and try to do some algorithm for the 25 tables one at a time and then, the output of the records append to a table in a filename, let say Tbl.010?
3. How can get the data value in psmain tables for a particular field and then the generated data append to a table in a filename, let say Tbl.010?
Draft of my pseduocode
Using a 'FOR' loop
Open table psmain01.dbf in an array type
while !eof
Read data from a particular field
do some algorithm to generate some results
skip next record
append the output to a table in a filename
create an index for a particular field
Repeat procedure for 25 times