wwc_um
February 20th, 2000, 07:49 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. 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?
2. 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?
3. How can I create an index for "NounCode" in ascending order?
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. 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?
2. 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?
3. How can I create an index for "NounCode" in ascending order?
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