Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

create a new database from textboxes?

Posted on 1998-03-02
4
Medium Priority
?
149 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

715 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