Others

Design Compound Values and Join Queries in Microsoft Access

Adam DavisAdam Davis Nov 25, 2026 869 views

Question details

The user needs a relational design for compound values and queries that retrieve related records.

Design Compound Values and Join Queries in Microsoft Access
Product
Microsoft Access
Device & OS
not provided
Scenario
A database stores values such as 601_5500025 in one field and needs efficient joins, filtering, indexing, and validation.
Observed behavior
Storing both logical values together makes relational operations and validation more difficult, while lookup and calculated table fields can obscure the underlying structure.
Before you start

Identify the components of each compound value and check whether they must preserve leading zeros. Review existing records for missing delimiters, duplicates, and inconsistent formats before splitting them.

Solution 1Recommended

Store Separate Values and Join Tables by Key

Use separate fields for each logical value and an indexed key to relate records reliably.

1
Create separate fields

Open the account table in Design View and add AccountGroup and AccountNumber fields. Use Short Text where leading zeros or nonnumeric characters must be preserved.

2
Define a primary key

In Design View, add an AccountID AutoNumber field if the table does not already have a suitable key. Select the field and click Primary Key.

3
Add a matching foreign key

In the related table's Design View, add an AccountID Number field with the Long Integer field size to match the AutoNumber primary key. Index it if appropriate for your queries.

4
Create the relationship

Open Database Tools > Relationships, add both tables, and drag the primary table's AccountID onto the related table's AccountID. Select Enforce Referential Integrity when appropriate, then click Create.

5
Build the join query

Select Create > Query Design, add both tables, and verify that AccountID joins them. Add the fields you need to the query grid and click Run.

6
Combine values for display

In an empty query grid column, enter DisplayAccount: [AccountGroup] & "_" & [AccountNumber]. Use this calculated result in a query, form, or report rather than storing a duplicate compound value.

Store Separate Values and Join Tables by Key
Validate the underlying fields: Set field properties and validation rules for each component as needed. A surrogate AccountID does not by itself prevent duplicate AccountGroup and AccountNumber combinations; enforce that rule separately if the combination must be unique.
Free Microsoft Office alternative

Review Account Data in WPS Spreadsheets

WPS Office is a free, lightweight alternative with a familiar interface for reviewing and editing exported account data. It supports common Office formats for easier migration, but it does not replace Access relationships or join queries.

Review separated account fields in a spreadsheetOpen and edit Microsoft Excel XLSX filesUse a familiar interface to work with exported Office documentsWork with a free, lightweight Office suite
QA img-9

Frequently Asked Questions

Should AccountGroup and AccountNumber be text or number fields?

In the table's Design View, use Short Text if either value can contain leading zeros or nonnumeric characters. Use a numeric type only when the value is genuinely numeric and its formatting does not need to be preserved.

How do I display the two fields as one value?

In Query Design, add a calculated column such as DisplayAccount: [AccountGroup] & "_" & [AccountNumber]. This displays the combined value without storing a redundant copy.

How can I prevent duplicate account combinations?

If each AccountGroup and AccountNumber combination must be unique, create a unique composite index on those fields in the table's Indexes window. Check and resolve existing duplicates first.

Do lookup fields create table relationships automatically?

A lookup field can display a friendly value while storing a key, but its display can obscure the underlying data. Inspect Database Tools > Relationships and the table's field definitions to verify the actual keys and relationship.