Solved

Converting a Access 2000 DB to a 97DB in VBA

Posted on 2002-07-19
5
760 Views
Last Modified: 2007-11-27
I am trying to write this code to create a copy of the
main 4 tables in my database into a different Access
database.

I am using Access 2000 and need to convert a copy of the
backup database to 97 for a co-worker.

The code below works fine until the line:

DoCmd.RunCommand acCmdConvertDatabase

I get a runtime error of 2046 and a message that says  
   
The comaand or action 'Convert DataBase' isn't    
availble now


I even created a database with an sub that had
DoCmd.RunCommand acCmdConvertDatabase as its only line and
the message was the same.

Any ideas to get this to work or another way to do it.


Thanks

Charley

=======Code===
Sub NewAccessDatabase()
Dim appAccess As Access.Application
Dim dbsCurrent As Database, dbsContacts As Database
Set dbsCurrent = CurrentDb

    Dim dbs As Object, tdf As Object, fld As Variant
    Dim strDB As String
    Const DB_Text As Long = 10
    Const FldLen As Integer = 40

    ' Initialize string to database path.
    strDB = "C:\Newdbcwd7.mdb"
    ' Create new instance of Microsoft Access.
    Set appAccess = _
        CreateObject("Access.Application.9")
    ' Open database in Microsoft Access window.
    appAccess.NewCurrentDatabase strDB
    ' Get Database object variable.
      Set appAccess = Nothing
 Set dbs = CurrentDb()
Set dbsContacts = DBEngine.Workspaces(0).OpenDatabase
(strDB)
    ' Create new table.
    DoCmd.CopyObject strDB, , acTable, "tblCuidOld"
   
    DoCmd.RunCommand acCmdConvertDatabase
.

0
Comment
Question by:charleyd
[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
5 Comments
 
LVL 9

Expert Comment

by:perove
ID: 7164976
If it is just the tables, you could export them to XL (or something), then start access97  and import them.

I havent done converting backwards, but to ubgrade say from 2000->2002 it is important to do a compile/save all modules AND a compact before starting the operation..



perove
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 7165296
why don't you simply use the Access 2000 capability to Convert to the earlier verion:

Under Tools/Database Utilities/Convert Database   this will convert the 2000 Database back to a Access 97.

Make a Copy, and then convert the copy back to Access 97.

Arthur Wood
0
 

Author Comment

by:charleyd
ID: 7165376
perove

I am no longer running Access 97.

Authur

I am trying do the conversion in VBA. I am presently using the menus.

Thanks

0
 
LVL 28

Accepted Solution

by:
TextReport earned 200 total points
ID: 7165494
All you need to do is the following, you will need a reference to MS DAO. dbVersion30 is for Access 95 and 97, Jet 3.0 and 3.5.


Sub EportTo97()
Dim db As Database

Const conNewFileName = "c:\My97.mdb"
    If Dir(conNewFileName) <> "" Then Kill conNewFileName
    Set db = DBEngine.CreateDatabase(conNewFileName, dbLangGeneral, dbVersion30)
    DoCmd.TransferDatabase acExport, "Microsoft Access", conNewFileName, acTable, "Table01", "Table01", False, False

End Sub

Cheers, Andrew
0
 

Author Comment

by:charleyd
ID: 7165738
Andrew

It works perfectly

Thanks

Charley

0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

631 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