Solved

Changing a field type while using INTO

Posted on 2001-07-26
5
601 Views
Last Modified: 2007-11-27
I am attempting to create a table called TempSentList that contains a list of people who belong to selected mail list(s). The mail list names are selected from an unbound list (that is the "criteria" reference in the code below).

Everything is looking good so far, except that I receive the following error:

Run-Time Error: 3090
Resultant table not allowed to have more than one AutoNumber field.

This is due to the fact that both the [Mail List].ID and the People.ID fields are AutoNumber.

Question: How can I convert one or both of these AutoNumber fields to a Number or even Text field in the process of creating this TempSentList table?

Thanks!




strSQL = "SELECT DISTINCTROW [Mail List].[Mail List], [Mail List].ID, [Mail List].Inactive, " & _
"People.ID, People.Last, People.First, People.Company, True As Selected, 1 as Copies " & _
"INTO TempSentList FROM [Mail List] LEFT JOIN [People] ON [Mail List].ID = People.ID " & _
"WHERE ((([Mail List].[Mail List]) = " & Criteria & "))"
0
Comment
Question by:FinanciallyFree
5 Comments
 
LVL 54

Accepted Solution

by:
nico5038 earned 150 total points
ID: 6324869
I would just create a result table on forhand (TempSentList ) and use a "DELETE * FROM TempSentList;" followed by an append query.

When the fields in the TempSentList are defined  as numeric, then you'll have no problems.

Nic;o)
0
 
LVL 18

Expert Comment

by:nigelrivett
ID: 6325220
try converting one of them to an int.
You may also get into trouble for duplicate named columns - can't remember what access does with that.

strSQL = "SELECT DISTINCTROW [Mail List].[Mail List], [Mail List].ID, [Mail List].Inactive, " & _
"PeopleID: cvint(People.ID), People.Last, People.First, People.Company, True As Selected, 1 as Copies " & _
"INTO TempSentList FROM [Mail List] LEFT JOIN [People] ON [Mail List].ID = People.ID " & _
"WHERE ((([Mail List].[Mail List]) = " & Criteria & "))"

(that syntax is probably wrong but the principle is worth a try).
0
 

Author Comment

by:FinanciallyFree
ID: 6327390
Nice and simple - I like it!!
Thanks, nico5038!

0
 
LVL 54

Expert Comment

by:nico5038
ID: 6327535
You're welcome FinanciallyFree.

Sccess with the application !

Nic;o)
0
 
LVL 1

Expert Comment

by:__Holly__
ID: 7138492
nico just a qucik note to let you know that you rock my world!!!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

790 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