Solved

Converting a Access 2000 DB to a 97DB in VBA

Posted on 2002-07-19
5
743 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
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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

867 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

21 Experts available now in Live!

Get 1:1 Help Now