Split database: front end and back end

When several people work with the same database, you split it: the tables live in the back end on a network drive, forms, reports and code in a front end on each user’s computer. The front end reaches the data through linked tables.

In short: a linked table holds the path to the back end in its Connect property, such as ;DATABASE=C:\Data\Shop_be.accdb; for local tables Connect is empty. When the back end moves, code sets Connect to the new path and calls RefreshLink.

Before you start: Import and export.

Why split?

  • Everyone has their own front end: changes to forms do not disturb anyone entering data.
  • You hand out a new front end without touching the data.
  • The back end holds only tables and relationships and is easy to back up.

Finding linked tables

The TableDefs collection holds every table, including system tables such as MSysObjects. A table is linked when Connect is not empty; SourceTableName gives its name in the back end. RecordCount returns -1 for linked tables; count them with DCount.

Task After splitting, some tables are linked to the back end. Write the procedure ListLinks: for every linked table (Connect not empty) it writes the name and the connection to the Immediate window, separated by “ | ”.

Customers 25 rows, 10 columns
CustomerIDCompanyFirstNameLastNameCityPostalCodeCountryCustomerSinceRegularDiscount
1NoahEvansLeedsLS1 1URUK28 Feb 2023☑0.1
2Shaw & PartnersNoahDaviesGlasgowG1 1XQUK5 Feb 2024☐0.03
3Northlight IncSophiaHallDenver80202USA30 Jun 2024☑0
4OliviaEvansBristolBS1 4DJUK29 Jun 2022☑0
5OliviaSmithLondonEC1A 1BBUK23 Sep 2025☑0
6Northlight IncMiaEvansManchesterM1 1AEUK1 Feb 2025☐0.1
7Bauer LtdAvaWilsonUK14 Oct 2024☐0.05
8LucasTaylorGlasgowG1 1XQUK2 Jul 2023☐0
9JackClarkSeattle98101USA7 Nov 2022☐0.1
10Northlight IncHenryTaylorDenver80202USA3 Nov 2022☑0.1
11Northlight IncOliverJohnsonBristolBS1 4DJUK6 Mar 2024☐0
12HenryTaylorChicago60601USA24 Dec 2023☐0
13Northlight IncNoahTaylorLondonEC1A 1BBUK12 Oct 2022☐0
14Summit ConsultingMiaSmithAustin78701USA6 Feb 2022☑0
15MiaClarkAustin78701USA9 Mar 2022☑0.05
16ChloeHallSeattle98101USA4 May 2022☐0.03
17Market Street ClinicSophiaJohnsonBoston02108USA4 Jun 2023☑0
18Roth LegalMiaWrightManchesterM1 1AEUK23 Sep 2022☑0.05
19Northlight IncGraceWrightUK16 Dec 2023☐0.03
20Northlight IncOliviaBrownBoston02108USA19 Jun 2023☐0.03
21LiamBrownBoston02108USA23 Jun 2025☐0.03
22Bauer LtdJamesJohnsonManchesterM1 1AEUK5 Jun 2025☐0.05
23NoahWilsonAustin78701USA23 May 2022☐0
24Market Street ClinicJamesSmithBristolBS1 4DJUK16 Jan 2022☐0.1
25Northlight IncSophiaHallDenver80202USA4 Aug 2025☑0

Relinking

After you change Connect, RefreshLink reconnects the table. If the file does not exist, Access reports 3044 (“'…' is not a valid path.”); on a local table Connect cannot be set (3219 “Invalid operation.”).

In real Access

  1. Make a backup first. The wizard for splitting is on the Database Tools tab; it moves the tables into a new file and links them.
  2. Put the back end on the network drive and point the links to the new path: in code as in the exercise, or with the linked-table manager on the External Data tab.
  3. Hand the front end out to every user.

Compact and repair

An Access file grows with use: the space of deleted records and objects is not freed on its own, and Access leaves temporary objects behind. Compact and Repair removes the unused space and repairs damage in the file; it does not compress the data. An Access database can be at most 2 GB.

  1. Nobody else may have the file open: compacting needs exclusive access. Make a backup first.
  2. Open the database and choose Database Tools, Compact and Repair Database (also under File, Info).
  3. In a split database, compact the back end as well: open the back-end file itself and compact it there. Compacting the front end does not shrink the tables in the back end.

For a database only you use, Compact on Close does it automatically (File, Options, Current Database). With several users, leave it off, because compacting briefly blocks the file.

Common mistakes

CurrentDb on every line

Set tdf = CurrentDb.TableDefs("Customers") gives a TableDef that is invalid after the statement (3420). Use Set db = CurrentDb first, then db.TableDefs(…).

Drive letters

A path with a drive letter only works if every computer maps the network drive to the same letter. A UNC path such as \Server\Share\Shop_be.accdb does not depend on that.

FAQ

Does the front end need relinking when data changes?

No. You only relink when the back end moves or the table structure changes.

How many users can a split Access database handle?

Microsoft gives the technical maximum of 255 concurrent users. With many simultaneous writes, a database server as the back end is the sturdier choice.

Next: the level 6 project

A member database with a macro and VBA.

Member database project

Write to us

Choose language

Select your preferred language