Solved

Create a Access Database in VB6

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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.
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…

777 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