At 16:40 17/04/2008 -0700, Kafka Noname wrote:
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.
Thanks Barbara,
I'm only new to this, and while your advice makes sense, I am
embarrassed 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.
You may - understandably - be opening the new table before trying to
paste into it. Don't do this. Instead, work in the Tables panel of
the database. Either drag the icon for the old table over the new
one, or use Copy and Paste to do the same thing - with the table
icons, that is. Either way, this brings up the "Copy table" dialogue,
one option of which is "Append data".
I trust this helps.
Brian Barker
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]