Solved

create a new database from textboxes?

Posted on 1998-03-02
4
144 Views
Last Modified: 2011-09-20
how do i create a new database from textboxes
which the user enters input..
like i have a "name:" textbox , "NRIC" textbox
and the user enter the data in these
textboxes and presses the submit button to
create a new database record..
0
Comment
Question by:Netboy
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Dalin
ID: 1458281
The easiest way is to create the database from Microsoft  Access or use the VB data mamanager.
Create database and the table:
On your VB desing enviroment, goto the menu "Add-In/Visual Data manager"
The data manager window will come out. Select the menu "File/New/Microsoft Access/Version7.0" (choose the proper database for youself). Enter the name of your database.
you should get the database interface.
Now right click the mouse and select "New Table"
Enter the name of your table. Then click on "Add Field"
You should be able to enter the information about all field in your table. When done, click on "Build table".

Now you have your table. Select "Utility/Data Form Designer", enter a name for the form, and slect your table as the record source, select all the fields. and click on OK.

You should get the form you want.

0
 

Author Comment

by:Netboy
ID: 1458282
i want to create a table from what the user inputs..
not what i create...
0
 

Author Comment

by:Netboy
ID: 1458283
how do i do this in access 97?
0
 
LVL 7

Accepted Solution

by:
tward earned 20 total points
ID: 1458284
The following will allow you to create a database on the fly within VB (for Access):

Public dbWorkspace As Workspace
Public dbDatabase As Database
Public dbTable1Def As TableDef
Public dbTable2Def As TableDef
Public dbFilename As Field
Public dbPageNumber As Field
Public dbPath As Field
Public dbHeader As Field

' Create the Database '
Set dbWorkspace = DBEngine.Workspaces(0)
Set dbDatabase = dbWorkspace.CreateDatabase("Database.mdb", dbLangGeneral)

' Create the Tables '
Set dbTable1Def = dbDatabase.CreateTableDef("Table1Name")
Set dbTable2Def = dbDatabase.CreateTableDef("Table2Name")

' Create the Fields '  
Set dbFilename = dbTable1Def.CreateField("Filename", dbText, 12)
Set dbPageNumber = dbTable1Def.CreateField("PageNumber", dbText, 8)
Set dbHeader = dbTable1Def.CreateField("Header", dbText, 10)

Set dbPath = dbTable2Def.CreateField("Path", dbText, 255)

' Append the Fields to the Appropriate Tables '  
dbTable1Def.Fields.Append dbFilename
dbTable1Def.Fields.Append dbPageNumber
dbTable1Def.Fields.Append dbHeader
dbTable2Def.Fields.Append dbPath

' Append the Tables to the Database '  
dbDatabase.TableDefs.Append dbTable1Def
dbDatabase.TableDefs.Append dbTable2Def
dbDatabase.Close
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question