Oracle 10g Database Standard (ODBSEONUPP0) Logo

Related Topics:

Posted on Apr 10, 2008

About visual basic coding

How to writ the code in visual basic to create database in Ms Access

1 Answer

Anonymous

Level 1:

An expert who has achieved level 1.

MVP:

An expert that got 5 achievements.

Scholar:

An expert who has written 20 answers of more than 400 characters.

Hot-Shot:

An expert who has answered 20 questions.

  • Contributor 40 Answers
  • Posted on Jan 24, 2009
Anonymous
Contributor
Level 1:

An expert who has achieved level 1.

MVP:

An expert that got 5 achievements.

Scholar:

An expert who has written 20 answers of more than 400 characters.

Hot-Shot:

An expert who has answered 20 questions.

Joined: Jan 24, 2009
Answers
40
Questions
0
Helped
28751
Points
75

Hello,
The standard way of creating a database using VBA, which can be modified to suit your needs is this--> Note: the code (wspDefault.CreateDatabase("Newdb.mdb"...), can be altered to save the database in a folder  such as "C:\NEWDB\text.mdb". sub NewDatabase()     Dim wspDefault As Workspace, dbs As Database     Dim tdf As TableDef, fld1 As Field, fld2 As Field     Dim idx As Index, fldIndex As Field     Set wspDefault = DBEngine.Workspaces(0)     ' Create new, encrypted database.     Set dbs = wspDefault.CreateDatabase("Newdb.mdb", _         dbLangGeneral, dbEncrypt)     ' Create new table with two fields.     Set tdf = dbs.CreateTableDef("Contacts")     Set fld1 = tdf.CreateField("ContactID", dbLong)     fld1.Attributes = fld1.Attributes + dbAutoIncrField     Set fld2 = tdf.CreateField("ContactName", dbText, 50)     ' Append fields.     tdf.Fields.Append fld1     tdf.Fields.Append fld2     ' Create primary key index.     Set idx = tdf.CreateIndex("PrimaryKey")     Set fldIndex = idx.CreateField("ContactID", dbLong)     ' Append index fields.     idx.Fields.Append fldIndex     ' Set Primary property.     idx.Primary = True     ' Append index.     tdf.Indexes.Append idx     ' Append TableDef object.     dbs.TableDefs.Append tdf     dbs.TableDefs.Refresh     Set dbs = Nothing End Sub
Hope this helps! Please let me know if you have any questions.Thank You,Raph30

Add Your Answer

×

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

305 views

Ask a Question

Usually answered in minutes!

Top Oracle Computers & Internet Experts

ADMIN Andrew
ADMIN Andrew

Level 3 Expert

73783 Answers

ADMIN Eric
ADMIN Eric

Level 3 Expert

42222 Answers

Anonymous

Level 1 Expert

1 Answers

Are you an Oracle Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...