Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Changing a field type while using INTO

Posted on 2001-07-26
5
Medium Priority
?
632 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 600 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

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
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.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

971 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