Create Database

bob bisquick

Registered User.
Local time
Today, 14:45
Joined
Nov 8, 2002
Messages
37
I am trying to extract some data from a database into a new database on a floppy. The extraction process is all set, but currently you have to manually create a database on a floppy. I want to automate the creation of this empty database.

This type of issue has been posted here before, but those solutions are not working. The first one:

http://www.access-programmers.co.uk/forums/showthread.php?t=35793&highlight=createdatabase

because it is in a seperate Sub. I need to slip this feature into the middle of a long string of code.

The other:

http://www.access-programmers.co.uk/forums/showthread.php?t=53429&highlight=createdatabase

basically has the same problem.

Some questions related to these solutions:

What is a workspace?
 
Can't you just make a call to the sub from your existing code? Or paste the code into your existing sub? Are you unsure of how to do that.

Note that code in both examples is written using DAO, the default data access technology in Access 97 and previous. If you're using Access 2000 or higher, you'll need to add a reference to DAO in the Visual Basic Editor.
 
Well, I found a solution elsewhere on the web:

Dim wrkDefault As Workspace
Dim dbsNew As DATABASE
Dim prpLoop As Property

' Get default Workspace.
Set wrkDefault = DBEngine.Workspaces(0)

' Make sure there isn't already a file with the name of
' the new database.
If Dir("A:\NewDB.mdb") <> "" Then Kill "A:\NewDB.mdb"

' Create a new encrypted database with the specified
' collating order.
Set dbsNew = wrkDefault.CreateDatabase("A:\NewDB.mdb", _
dbLangGeneral, dbEncrypt)

dbsNew.Close

But had to activate Microsoft DAO 3.6 for this to work. But it works perfectly.

I do not know how to do what you suggest, but maybe a moot point now.
 

Users who are viewing this thread

Back
Top Bottom