How do I change an autonumber field into a regular number field in a make-table query?

Posted on 2014-11-21
Last Modified: 2014-11-21
Hello,  I am running a simple make-table query.  I have two tables, tbl_Contacts and tbl_Categories, each of which has an auto number field.  In tbl_Categories, the auto number field is IdCategory.  As shown in the SQL below, I am trying to make a table, "temp" that includes all records from tbl_Contacts in addition to IdCategory from tbl_Categories.  I would like the field IdCategory to be an integer field in my new table but Access tries to bring it in as an auto number.  How can I change IdCategory into an integer in the course of running this query?

SELECT tbl_Contacts.*, tbl_Categories.[IdCategory] AS IdCategory2 INTO temp
FROM tbl_Categories RIGHT JOIN tbl_Contacts ON tbl_Categories.Category = tbl_Contacts.Category;
Question by:Saleve
LVL 35

Expert Comment

ID: 40458377
You may be able to coerce Access into doing it your way by using a function.

Select cLng(YourID) as NewID .....
LVL 120

Accepted Solution

Rey Obrero (Capricorn1) earned 500 total points
ID: 40458383
try this

SELECT tbl_Contacts.*, clng(tbl_Categories.[IdCategory]) AS IdCategory2 INTO temp
FROM tbl_Categories RIGHT JOIN tbl_Contacts ON tbl_Categories.Category = tbl_Contacts.Category;

Author Closing Comment

ID: 40458396
Perfect.  thanks!

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question