Results 1 to 5 of 5

Thread: Creating a database at runtime and saving the database

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    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

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    DAO or ADO?

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    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

  4. #4
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844

    Post

    You're probably using DAO. Here is an example that creates a database, a table, and two fields.

    Code:
        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

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2000
    Location
    Rhinelander, WI USA
    Posts
    59

    Post

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width