dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Advanced
Jan 8, 2001

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Creating an MSACCESS Database through VB


I have frequently seen bulletin board requests on how to create MSACCESS databases with VB. To do this, add a reference to the Microsoft DAO _._ Object Library (I am using Version 3.6 for the sample code below). Add the sample code where appropriate (e.g., call it from button click events on a form, and so on). The routine names are self-explanatory and the code is commented appropriately. Give it a whirl!
 
Public Sub CreateDB(ByVal pDatabaseUNC As String)
    Dim ws As Workspace
    Dim db As Database

    On Error GoTo Routine_Error

    'Create a new Database with the specified name
    Set ws = DBEngine.Workspaces(0)     'Default Workspace
    Set db = ws.CreateDatabase(pDatabaseUNC, dbLangGeneral)

    'Add a new table to the newly created database
    CreateTable db, 
Nazmul Siddiqui
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date