Solved

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

Posted on 2014-11-21
3
170 Views
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;
0
Comment
Question by:Saleve
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 37

Expert Comment

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

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

Accepted Solution

by:
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;
0
 

Author Closing Comment

by:Saleve
ID: 40458396
Perfect.  thanks!
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

724 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