Solved

Compiling ACCESS in a VB application

Posted on 1998-12-10
4
168 Views
Last Modified: 2010-05-03
Is there any possiblity to insert an access DB to a VB application, and generate an exe file, that will run on computers that have no MS-ACCESS installed? What is the best way to use the DB in the VB application?
0
Comment
Question by:schler
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
jjbyers earned 100 total points
ID: 1449232
You can't compile the MDB file as part of the application.

But you can include the MDB file in your setup program. Using the setup wizard just add it to the list of files needed.


0
 
LVL 12

Expert Comment

by:mark2150
ID: 1449233
You can even have your VB program create a .MDB on the fly. Access is *NOT* required on the target system. Here's some code:

Text1(2).Text is a control that has the drive:\path\ of the MDB file, REFMDB has the file name with the .MDB extension

db is PUBLIC ... AS DATABASE

'
' Crank up data engine to create database
'
Set db = DBEngine.Workspaces(0).CreateDatabase(Text1(2).Text & "\" & refmdb, dbLangGeneral)
Set tbl = db.CreateTableDef("Results")  'Configuration
'
' Filename - C20
' DiskVol  - C11
' Pagenum  - N3
' DateTime - Date/Time
' Client   - N6
' Debtor   - N6
'
Set fld = tbl.CreateField("Filename", dbText, 20)
fld.AllowZeroLength = True
tbl.Fields.Append fld
'
Set fld = tbl.CreateField("DiskVol", dbText, 11)
fld.AllowZeroLength = True
tbl.Fields.Append fld
'
Set fld = tbl.CreateField("Pagenum", dbInteger)
tbl.Fields.Append fld
'
Set fld = tbl.CreateField("DateTime", dbDate)
tbl.Fields.Append fld
'
Set fld = tbl.CreateField("Client", dbLong)
tbl.Fields.Append fld
'
Set fld = tbl.CreateField("Debtor", dbLong)
tbl.Fields.Append fld
'
Set ndx = tbl.CreateIndex("Key")
ndx.Fields.Append ndx.CreateField("Client")
ndx.Fields.Append ndx.CreateField("Debtor")
ndx.Unique = False
tbl.Indexes.Append ndx
'
Set ndx = tbl.CreateIndex("Location")
ndx.Fields.Append ndx.CreateField("FileName")
ndx.Fields.Append ndx.CreateField("PageNum")
ndx.Unique = False
tbl.Indexes.Append ndx
'
' Commit definition to master dataset
'
db.TableDefs.Append tbl
db.Close

0
 
LVL 12

Expert Comment

by:mark2150
ID: 1449234
P.S.

You *MUST* put a data control onto your form to let the compiler know to include the JET ISAM. I make the controls .Visible property = FALSE so it doesn't show. The control is *NOT* referenced anywhere in my code, but if you forget the empty control *NONE* of the code will work - very frustrating when I first had to figure *that* out.

M

0
 
LVL 3

Expert Comment

by:jjmartin
ID: 1449235
They've got it right.  You don't include ACCESS with the VB application.  The database is independant of ACCESS.  An ACCESS Database is ODBC compliant, and is accessed by VB through the Jet DB.  If you want to work with databases with out putting a data control on your form, in the Project References, select the Microsoft DAO 3.5 object library.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VBA color chart bars 12 76
MS Acccess - Update Field in Table when report is printed 6 43
Macro: print each sheet to pdf using ExportAsFixedFormat 11 38
vbModal 12 30
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

948 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

19 Experts available now in Live!

Get 1:1 Help Now