Solved

Changing a field type while using INTO

Posted on 2001-07-26
5
570 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
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…
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…

707 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

12 Experts available now in Live!

Get 1:1 Help Now