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
Solved

create a new database from textboxes?

Posted on 1998-03-02
4
145 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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

840 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