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 34

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 119

Accepted Solution

Rey Obrero 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In the previous article, Using a Critera Form to Filter Records (, the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

744 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now