Table of contents
TOC
Collapse the table of content
Expand the table of content

DoCmd.TransferSQLDatabase Method (Access)

office 365 dev account|Last Updated: 6/12/2017
|
1 Contributor

Transfers the entire specified Microsoft SQL Server database to another SQL Server database.

Syntax

expression. TransferSQLDatabase( ** Server, ** Database, ** UseTrustedConnection, ** Login, ** Password, ** TransferCopyData )

expression A variable that represents a DoCmd object.

Parameters

NameRequired/OptionalData TypeDescription
ServerRequiredVariantThe name of the SQL Server to which the database will be transferred.
DatabaseRequiredVariantThe name of the new database on the specified server.
UseTrustedConnectionOptionalVariantTrue if the current connection is using a login with system administrator privileges. If this argument is not True, you must specify a login and password in the Login and Password arguments.
LoginOptionalVariantThe name of a login on the destination server with system administrator privileges. If UseTrustedConnection is True, this argument is ignored.
PasswordOptionalVariantThe password for the login specified in Login. If UseTrustedConnection is True, this argument is ignored.
TransferCopyDataOptionalVariantTrue if all data in the database is transferred to the destination database. If this argument is not True, only the database schema will be transferred.

Remarks

The following conditions must be met or else an error occurs:

  • The current and destination servers are SQL Server version 7.0 or later.

  • The user has system administrator login rights on the destination server.

  • The destination database doesn't already exist on the destination server.

Example

This example transfers the current SQL Server database to a new SQL Server database called Inventory on the server MainOffice. (It is assumed that the user has system administrator privileges on MainOffice.) The data is copied along with the database schema.

DoCmd.TransferCompleteSQLDatabase _ 
 Server:="MainOffice", _ 
 Database:="Inventory", _ 
 UseTrustedConnection:=True, _ 
 TransferCopyData:=False 

See also

Concepts

DoCmd Object

© 2017 Microsoft