?
Solved

Compiling ACCESS in a VB application

Posted on 1998-12-10
4
Medium Priority
?
174 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
[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
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
jjbyers earned 200 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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

649 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