Solved

create a new database from textboxes?

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Specify ip address in my connection string for sas 2 52
Updates not working for MS Windows 7 12 152
passing parameter in sql procedure 9 56
Add a task in Outlook from access 11 35
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
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…

930 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now