PDA

Click to See Complete Forum and Search --> : Creating a database at runtime and saving the database


Leeper77
Jan 23rd, 2000, 02:56 AM
I have a question ok i have a database i want to be created at run time how do i go about doing that in the program its a personal inventory so it has to be saved evertime things are added and updated so if any of you could help me that would be great :)

Clunietp
Jan 23rd, 2000, 03:16 AM
DAO or ADO?

Leeper77
Jan 23rd, 2000, 04:06 AM
i use the data control in the other databases i dont know much about the differant types. But i do know what i want it to do. the database that will be used could be viewed in its own form with a datacontrol hopefully. I hope im not confusing you but im not the best at vb

Clunietp
Jan 23rd, 2000, 05:45 AM
You're probably using DAO. Here is an example that creates a database, a table, and two fields.


Dim db As Database
Dim tbl As TableDef


'create the database
Set db = DBEngine.CreateDatabase("C:\test.mdb", dbLangGeneral)


'create table object
Set tbl = New TableDef
tbl.Name = "New Table"


'add fields to table
tbl.Fields.Append tbl.CreateField("TestField", dbText, 100)
tbl.Fields.Append tbl.CreateField("AnotherField", dbText, 50)


'add the table to the database
db.TableDefs.Append tbl


'close database
db.Close
Set db = Nothing



HTH

Tom

Leeper77
Jan 23rd, 2000, 05:54 AM
ok thats kinda how i did it but i have one more question.

I would like to copy one row from one database and control and form to another database and control and form any idea on how i can do this?

thanks