How to Create Microsoft Access SKUs with Department Prefixes
Question details
The user needs to generate custom stock-keeping units (SKUs) in a database where the prefix identifies the department and the suffix identifies the product.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Managing an inventory database and assigning structured product codes dynamically.
- Observed behavior
- Needs to automatically combine a department code with an AutoNumber or calculated sequence to display a formatted SKU like 101-0001.
Ensure you have a foundational understanding of table design in Access, specifically involving primary keys, foreign keys, and basic calculated fields.
Use AutoNumber with Concatenation for a Global Sequence
Best for databases that do not require the product ID to restart at 1 for every new department.
If a single continuous numerical sequence across all departments is acceptable, you can combine the standard AutoNumber feature with the department code for display purposes.
Open your Products table in Design View. Set an AutoNumber field as the primary key (ProductID) and add a foreign key field for DepartmentID.
In your form or query, create a new calculated field to combine the two values into a single SKU string.
Use the expression =Format([DepartmentID],"000") & "-" & Format([ProductID],"0000") to generate the final SKU output (e.g., 101-0001).

Calculate Department-Specific Sequences in Code
Use this method if each department's SKU sequence must start from 0001 independently.
Manage Inventory and SKUs Easily with WPS Office
While Microsoft Access requires complex setup for databases, WPS Spreadsheet offers an intuitive and free alternative for managing inventory, tracking stock, and generating custom SKUs with simple formulas. WPS Office provides full compatibility with Microsoft Office formats, a familiar interface, and lightweight performance.
- 1. Open WPS Spreadsheet: Create a new workbook or open your existing inventory tracker document.
- 2. Set up your tracking columns: Create adjacent columns for 'Department Code', 'Item Number', and 'SKU'.
- 3. Apply a text formula: In the SKU column, enter a formula like =TEXT(A2,"000")&"-"&TEXT(B2,"0000") and drag it down to auto-generate structured SKUs.

Frequently Asked Questions
Why doesn't AutoNumber work for department-specific sequences?
AutoNumber in Microsoft Access is designed to create a single, continuous, and globally unique sequence for an entire table. It cannot reset or run multiple independent sequences based on a foreign key like a Department ID.
How do I prevent duplicate SKUs in a multi-user Access database?
When calculating custom sequences via code (like using DMax), you must apply a unique composite index combining the DepartmentID and ProductID in the table design. This ensures that simultaneous entries do not accidentally generate the same SKU.
Can I hide the base IDs and only show the formatted SKU in forms?
Yes, you can bind your form's text box to a query that concatenates the DepartmentID and ProductID into the formatted SKU, or input the Format expression directly into the control source of an unbound text box.




