Solved

Create a Access Database in VB6

Posted on 2001-06-19
5
162 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
5 Comments
 

Expert Comment

by:VBSysCOM1
Comment Utility
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
Comment Utility
I am running VB6 SP5.  ADO control.
0
 
LVL 18

Expert Comment

by:bobbit31
Comment Utility
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 69

Accepted Solution

by:
Éric Moreau earned 100 total points
Comment Utility
0
 
LVL 18

Expert Comment

by:bobbit31
Comment Utility
emoreau: nice link!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

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…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
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…
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…

728 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

10 Experts available now in Live!

Get 1:1 Help Now