Ms-access – MS Access: Issue with Autonumbers in the export

exportms access

I have a question that might be trivial to solve, but I have spent some time on it and didn't manage to solve it.

I am working on a database in MS Access, in which I keep track of the specifications of mechanical parts such as valves, pipes, and instruments. These components are grouped in tables, each one containing a class of components.
The single components can be described by parameters such as diameter, media used, and other fields. These values are fixed (e.g. the media will always be water, air, hot gas etc.), so they are stored in auxiliary tables, that are called once the user is filling the form using a combo box.

So far, everything good: the user sees the media in the combo box and I can select the same combo box from the view in the database table.
Once I export the file in Excel, I have a problem: the file is not reporting the "Description" field in the Auxiliary table – such as "water" – but its Autonumber.
How can I solve the problem? I would like to have an exported file that is showing the information displayed in the auxiliary table, and not the AutoNumber connected to it.
I have tried to solve the issue in this way:

  • The existing Relationship was between the Autonumber, as Primary key, and the field in the table, as foreign key. I deleted the relationship, set the "description" field as Primary key and made a new Relationship between the description in the auxiliary table and the foreign key.
    The problem in this case is that the new fields are stored correctly, but the old fields remain as numbers. I wouldn't like to reinsert manually all the values, if it is possible to avoid it.

How can I convert all the information that is currently stored as number in its correspondant value in the auxiliary table?

Thank you very much in advance!

Best Answer

You will need to write a query or report that joins between the tables so you can select the description.

The Image below shows the MS Access query designer. It displays both tables and the join between them. Below that it shows the fields I want to return in my query.

Query design view

You can also view the SQL Query, in this example it would look like this:

SELECT Inventory.Item_id, Inventory.Item_name, Media.Description
FROM Inventory INNER JOIN Media ON Inventory.Media = Media.Media_id;

The query result look like this:

Query result