Thanks Barbara,

I'm only new to this, and while your advice makes sense, I am embarrased to
say that I haven't been able to append data to the new table. I've tried
copying and pasting from the original table but that only pastes the data
from the first field. OpenOffice help doesn't really help because it refers
to functions I can't locate. I am guessing that it's really simple if you
know which buttons to press.


Barbara Duprey wrote:
> 
> kafka1 wrote:
>> I have created a table containing my music collection by importing an
>> Excel
>> Spreadsheet. After a lot of trial and error, almost everything is working
>> fine, however when I create a new record I have to manually enter a
>> number
>> in the ID (Primary key) field. This is a bit of a nuisance as it means I
>> have to determine the ID number of the last record. I have done what has
>> been suggested in another forum, i.e. set the AutoValue for ID to Yes,
>> however all that happens that a zero is placed in the ID field. It was
>> also
>> suggested that I set the Auto-increment statement to IDENTITY, however I
>> don't have that option in Field properties.
>>
>> I have also typed ALTER TABLE "Table1" ALTER COLUMN "ID" IDENTITY in the
>> SQL
>> window, but without success. Is there any other way I can have the ID
>> automatically insert the next number?
>>   
> I've had the best luck with this kind of thing by defining a new table 
> with all the fields as needed, including an auto-increment primary key 
> field, and then appending the data from the existing table (leaving out 
> the manually generated key). After that, the original table can be 
> discarded, and new records get the right key automatically. Even when 
> I'm working inside a query that is a subset of the data and not sorted 
> by the key; I can go to the last record and add a record, and it uses 
> the next available record number for the table.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Auto-increment-ID-in-a-database-tp16698582p16757946.html
Sent from the openoffice - users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to