Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

AutoNumber fields to Number when exporting to another Database (v97)

Status
Not open for further replies.

richard1458

Instructor
Oct 21, 2000
27
GB
I have a maketable query that exports data to another database. It currently preserves the AutoNumber field form the orginal table. I don't want to do this - I want the field in the destination table to be an ordinary Number field, since only the source database is responsible for generating the records.
Should I:
1. Create an expression in the MakeTable query that simply returns the current value of each AutoNumber field OR
2. Try and write some code so that when opening the target database, the AutoNumber fields are automatically redefined as Number fields (and if so, what is the code and where would I put it to ensure that it runs every time I open the database).
Many thanks [sig][/sig]
 
Hi Richard,

change the cteate table statement to only make the field into a long integer.

option 1

CREATE TABLE Table (field1 LONG, fieldn Type....);

then an append query to populate the new table

OR
this will create a new table "DestTable" and populate the table with records from source.

SELECT CLng([SourceTbl].[Field1]) AS Field1, SourceTbl.Field1, SourceTbl.Field2, SourceTbl.Field3 INTO DestTable
FROM SourceTbl;
here field 1 is the source table autonumber field converted to a stanard long integer type ;-)

HTH
[sig]<p>Robert Dwyer<br><a href=mailto:rdwyer@orion-online.com.au>rdwyer@orion-online.com.au</a><br>[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top