Skip to content
Auscultby NBIT
EN
Free diagnostic

Use case

Migrate an Access database to SQL Server with SSMA

The database keeps growing, more people use it, corruption keeps coming back: a common answer is to keep Access for the forms and move the data to SQL Server. Microsoft provides a free tool for this, SQL Server Migration Assistant (SSMA) for Access. It moves the tables and the data; it does not touch forms, reports or VBA code. Here are the steps, then what breaks afterwards.

What SSMA does, and what it doesn't

SSMA reads an Access 97 or later database and converts it for SQL Server 2019 or later (on Windows or Linux), Azure SQL Database or Azure SQL Managed Instance. It recreates tables, indexes, foreign keys, default values and validation rules (as CHECK constraints), then copies the data.

What SSMA converts, according to Microsoft's documentation
In the Access databaseAfter SSMA
Tables, columns, indexes, relationshipsRecreated in SQL Server
Select queriesMost become views
Parameter queries, crosstab queriesNot converted
Action queries (update, append, delete)Not migrated
Forms, reports, macros, VBA modulesNot converted: they stay in Access

"Not migrated" does not mean lost: a query that stays in Access keeps running, but against tables linked to SQL Server. The Access application remains, and that is what has to work after the migration.

Before you run SSMA

  1. Work on a copy of the Access database, and back up the target SQL Server database too.
  2. Check that the database works: a form already broken in Access will still be broken after the migration, and the migration will get the blame.
  3. Remove workgroup security (.mdw file) from old .mdb databases: SSMA cannot migrate a database that uses it.
  4. Give every table a primary key: a table without a unique index cannot be updated once it is in SQL Server.
  5. Look for out-of-range dates: SQL Server's datetime type starts on 1 January 1753, while Access accepts dates from the year 100. A year typed "0195" instead of "1995" is enough.
  6. Find names that are SQL Server reserved words, or that contain special characters: rename them, or bracket them in every query that uses them.

The steps in SSMA

  1. Create a project (File › New Project) and choose the target: SQL Server or Azure SQL.
  2. Add the Access database (Add Databases).
  3. Connect to SQL Server (Connect to SQL Server), preferably with Windows authentication.
  4. Produce the assessment report (Create Report): it lists what will not convert, object by object.
  5. Convert the schema (Convert Schema): nothing is created on the server yet, the conversion stays in the project. Read the error list.
  6. Load into the target database (Synchronize with Database): tables and views are created.
  7. Migrate the data (Migrate Data).
  8. Link the tables (Link): SSMA keeps a copy of each original Access table and replaces it with a table linked to SQL Server.

Pitfalls after the migration

  • Slow queries: a query that calls a VBA function, or an Access function SQL Server does not know, makes Access pull the table down to filter it on the PC. Fix: pass-through query, view or stored procedure.
  • An empty AutoNumber right after AddNew: in SQL Server, the IDENTITY value only exists once the record has been saved.
  • Error 3622: OpenRecordset on a SQL Server table with an IDENTITY column requires the dbSeeChanges option.
  • A form where you can no longer add records: its record source must include every column of at least one unique index of the table.
  • Hyperlinks turned into text: SQL Server has no such type, the column becomes nvarchar(max).
  • A PC without the ODBC driver: the linked tables do not open, with error 3151.
Written for an Access table: with a table linked to SQL Server, OpenRecordset raises error 3622, and the number is empty before Update.
Set rs = CurrentDb.OpenRecordset("Invoices", dbOpenDynaset)
rs.AddNew
rs!CustomerID = 42
MsgBox rs!InvoiceNo       ' empty with SQL Server
rs.Update
Fixed: dbSeeChanges, then read the number from the record that has just been saved.
Set rs = CurrentDb.OpenRecordset("Invoices", dbOpenDynaset, dbSeeChanges)
rs.AddNew
rs!CustomerID = 42
rs.Update
rs.Bookmark = rs.LastModified
MsgBox rs!InvoiceNo       ' filled in
Microsoft Visual Basic box: “Run-time error '3151': ODBC--connection to '{SQL Server} SRV-SQL01' failed.”
The real error box, captured in Access for Microsoft 365: a pass-through query targets a SQL server the PC cannot reach.

Know what the database contains before migrating

The Auscult diagnostic does not migrate anything. Before SSMA, it tries every form, every report and every query in the Access on your PC, and tells you what works and what already fails, with the cause: there is no point migrating a fault. The full report also sizes the migration: simple elements or elements with code, lines of code, heaviest modules — the basis for a quote. See the pre-migration audit and, for the overall approach, migrating an Access application.

Sources

All articles

Frequently asked questions

Is SSMA free?

Yes. Microsoft distributes it free of charge; it installs on Windows 11 or Windows Server 2022 and later, with .NET Framework 4.7.2 or later.

Can we keep Access after the migration?

Yes, that is the most common case: forms, reports and VBA code stay in Access, the data lives in SQL Server, and the application reaches it through linked tables.

What happens to the queries SSMA does not convert?

They stay in Access and run against the linked tables. Those that are slow or call VBA functions should be rewritten as views, pass-through queries or stored procedures.

Does the VBA code work unchanged?

Often, but not always: dbSeeChanges, AutoNumbers read before the record is saved, Access-specific syntax in SQL sent to the server. Every form needs trying after the migration.

Where are the other errors in your application hiding?

The diagnostic runs on your computer, on a copy of the application, without sending the data in your tables. The health grade and the summary are free.