Solved

Create a Access Database in VB6

Posted on 2001-06-19
5
170 Views
Last Modified: 2010-05-02
I would like some help on creating an Access 2000 Database with tables and fields in vb code.
0
Comment
Question by:nongravity
[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
5 Comments
 

Expert Comment

by:VBSysCOM1
ID: 6207604
1.) What data control are you going to use.
2.) What sevice pack is installed



Thank You Have A Good Day!
0
 

Author Comment

by:nongravity
ID: 6207623
I am running VB6 SP5.  ADO control.
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6207664
use the ms access object library (under project/references)
(note: access will have to be installed on the client machine)

to create a new access database:

Dim accApp As New Access.Application
accApp.DBEngine.CreateDatabase "C:\my documents\newDB.mdb", <locale info as string>
accApp.Quit

Dim myCN As New ADODB.Connection
Dim strSQL As String

myCN.open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
          "Data Source=C:\my documents\newDB.mdb;"

strSQL = "Create table tblNew ( field1 text )"
myCN.execute strSQL
myCN.Close

code not tested
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 100 total points
ID: 6207699
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 6207750
emoreau: nice link!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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…
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
Course of the Month9 days, 21 hours left to enroll

623 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