NewCurrentDatabase Method

NewCurrentDatabase Method

See Also         Example         Applies To

You can use the NewCurrentDatabase method to create a new Microsoft Access database (.mdb) in the Microsoft Access window. You can use this method to create a new database from another application that is controlling Microsoft Access through Automation, formerly called OLE Automation. For example, you can use the NewCurrentDatabase method from Microsoft Excel to create a new database in the Microsoft Access window.

Note   You can use the NewAccessProject method to create a new Microsoft Access project (.adp) in the Access window.

Syntax

application.NewCurrentDatabase dbname

The NewCurrentDatabase method has the following arguments.

Argument Description
application The Application object.
dbname A string expression that is the name of a new database file, including the path name and the file name extension. If your network supports it, you can also specify a network path in the following form:

\\Server\Share\Folder\Filename

  Note   If you don't supply the filename extension, .mdb is appended to the filename.

Remarks

The NewCurrentDatabase method enables you to create a new Microsoft Access database from another application through Automation. Once you have created an instance of Microsoft Access from another application, you must also create a new database. This database opens in the Microsoft Access window.

If the database identified by dbname already exists, an error occurs.

The new database is opened under the Admin user account.