Re: Create an Access 2000 format database using DAO?
- From: Cory J. Laidlaw, Beyond01.com <CoryJLaidlawBeyond01com@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 27 Feb 2008 07:21:03 -0800
Hi Rob,
This did the trick! Thanks much for the updated code snippet.
You da man!
Cory
"Robert Morley" wrote:
The gist of it is that only the Forms, Reports, Macros and Modules are.
stored in a different format for each. The Tables and Queries are stored in
a generic format that's the same for both. Since DAO only knows about
Tables and Queries, it can't really create a database that's one or the
other; it creates a v4.0 database which is later modified by Access itself
to be whichever format it wants. This also explains the behaviour you saw
with your code in Alex's sub-thread; there's no version to the database
until you actually open it.
What the conversion utility does is to convert all the other objects from
2000 to 2002/2003. If you change your options to view System Objects,
you'll see an MSysAccessObjects in 2000 vs. and MSysAccessStorage in 2002/3.
This is where all the Forms, Reports, etc. are stored.
Oh and it appears that Norton has corrupted you. It's not "symantecs", it's
"semantics". ;)
Anyway, if it's important for you to select the database format before first
GUI access, try the following code instead. Note that if you need "tdb" to
point to the database once it's done, you'll have to re-open the database
through DAO afterwards. Access can't create the necessary table while DAO
has a lock on it (at least I don't think so...you can try opening it in
shared mode and see if that works out).
Public Sub MyCreateDatabase(ByVal TargetPath As String)
Dim tdb As DAO.database
Dim accapp As Access.Application
Dim PrevSetting As Variant
' create new microsoft access database file in Access 2000 format.
On Error Resume Next
Kill TargetPath
On Error GoTo 0
Set tdb = DBEngine.Workspaces(0).CreateDatabase(TargetPath, dbLangGeneral)
tdb.Close
Set tdb = Nothing
Set accapp = New Access.Application
PrevSetting = accapp.GetOption("Default File Format")
accapp.SetOption "Default File Format", 9
accapp.OpenCurrentDatabase TargetPath
accapp.CloseCurrentDatabase
accapp.SetOption "Default File Format", PrevSetting
Set accapp = Nothing
End Sub
Rob
Cory J. Laidlaw wrote:
Hi Robert,
Thanks for your feedback. I am a bit confused.
If they are the same format, why in access 2003 is there a tool(database
utilities( to convert them to 2000 format and when using a 2000 format
database, the tool converts a database up to 2002-03?
Your saying this is just symantecs of the current access application?
Thank you. I appreciate your feedback! :)
Cory
"Robert Morley" wrote:
If I recall correctly, at the low level, Access 2000 and Access 2002/2003
are actually the same database format. So if you create a Version40
database through code, the identifiers as to whether it's 2000 or 2002/3
will only be added when you open that database up through the GUI and
they're added by Access itself (as opposed to DAO). So at that point, as
Alex indicated, it's controlled by the setting in your preferences.
I'm a little rusty, so I might be wrong, but I'm pretty sure that's how it
works.
Rob
Cory J. Laidlaw wrote:
Hi,
I've tried the following line of code:
Set tdb = DBEngine.Workspaces(0).CreateDatabase(TargetPath, dbLangGeneral,
dbVersion30)
it creates an access 97 version of the database. This line of code:
Set tdb = DBEngine.Workspaces(0).CreateDatabase(TargetPath, dbLangGeneral,
dbVersion40)
Creates an access 2002-2003 version.
Does anyone know how to create an Access 2000 Version?
Many Thanks!!
Cory
- References:
- Re: Create an Access 2000 format database using DAO?
- From: Robert Morley
- Re: Create an Access 2000 format database using DAO?
- From: Cory J. Laidlaw, Beyond01.com
- Re: Create an Access 2000 format database using DAO?
- From: Robert Morley
- Re: Create an Access 2000 format database using DAO?
- Prev by Date: DAO references / Access 2007
- Next by Date: RE: Changing a Sub Procedure to a Function
- Previous by thread: Re: Create an Access 2000 format database using DAO?
- Next by thread: Re: Getting the Function Name
- Index(es):
Relevant Pages
|