Design Compound Values and Join Queries in Microsoft Access
Question details
The user needs a relational design for compound values and queries that retrieve related records.

- 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.
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.
Store Separate Values and Join Tables by Key
Use separate fields for each logical value and an indexed key to relate records reliably.
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.
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.
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.
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.
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.
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.

Split Existing Compound Values Before Creating Relationships
Use this approach when existing records already contain values such as 601_5500025 in one field.
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.

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.




