Microsoft KB Archive/141886

= ACC: How to Create a Version 2.0 Database Using Access 95/97 =

Article ID: 141886

Article Last Modified on 1/19/2007

-

APPLIES TO


 * Microsoft Access 95 Standard Edition
 * Microsoft Access 97 Standard Edition

-



This article was previously published under Q141886



Moderate: Requires basic macro, coding, and interoperability skills.



SUMMARY
This article shows you how to use Data Access Objects (DAO) in Microsoft Access 95 or 97 to create a Microsoft Access 2.0 database and how to copy entire tables from a Microsoft Access 95 or 97 database to the newly created Microsoft Access 2.0 database. This technique enables you to share data with others who run Microsoft Access 2.0.

This article assumes that you are familiar with Visual Basic for Applications and with creating Microsoft Access applications using the programming tools provided with Microsoft Access. For more information about Visual Basic for Applications, please refer to your version of the "Building Applications with Microsoft Access" manual.



MORE INFORMATION
To create a Microsoft Access 2.0 database and copy tables from the current Microsoft Access 95 or 97 database, follow these steps:  Create a new module.  Type the following procedure: Public Function CreateDB Dim newdb As DATABASE, mydb As DATABASE Dim dbname As String Dim tdf As TableDef

'Set the path and name for the new database. dbname = "c:\msoffice\access\Newdb.mdb"

'Create the new 2.0 database and close newdb. Set newdb = DBEngine.Workspaces(0).CreateDatabase(dbname, _        dbLangGeneral, dbVersion20) newdb.Close

'Export all non-system tables to the version 2.0 database. Set mydb = CurrentDb For Each tdf In mydb.TableDefs If (tdf.Attributes And dbSystemObject) = 0 Then DoCmd.TransferDatabase acExport, "Microsoft Access", _ dbname, acTable, tdf.Name, tdf.Name End If        Next tdf

End Function  To test the function, type the following line in the Debug window, and then press ENTER.

? CreateDB

Note that the new version 2.0 database is created (in the location you specified) and that all nonsystem tables in the current version database are exported to the new version 2.0 database.

NOTE: You can export only tables to a Microsoft Access 2.0 database; you cannot export other database objects such as forms or reports. If you try to export other objects, you receive the following error:

Run-time error '7854':

You can't export database objects (except tables) from the

current version of Microsoft Access to previous versions of

Microsoft Access.

In addition, you cannot export tables from databases that have been replicated because these tables have system-defined fields with a data type of ReplicationID. Microsoft Access 2.0 does not have a ReplicationID data type.

