Avatar billede dtn Nybegynder
08. januar 2001 - 12:28 Der er 5 kommentarer og
1 løsning

Ændring på Autonummerering-funktion?

Kan man nulstille / få Autonummerering-funktion til at starte på et bestemt nr.?
Avatar billede kasseper Nybegynder
08. januar 2001 - 12:33 #1
NEJ, det kan du kun hvis du laver x antal poster og sletter dem igen, så starter du fra det næste nummer.....!
Avatar billede piphans Nybegynder
08. januar 2001 - 12:37 #2
Du kan ikke nulstille autonummereringen, men hvis du sletter feltet og opretter det igen, så starter nummereringen forfra.
Og jeg går ud fra at der ikke er nogen poster i tabellen hvis du vil starte nummereringen forfra?
Avatar billede horus Nybegynder
08. januar 2001 - 13:19 #3
Det kan du SAGTENS.

Nedenstående er taget fra dette link: http://www.cabrillo.cc.ca.us/~ggriffith/ACauto.htm

Held og lykke

Horus


For a new table that contains no records, you can change the starting value of an AutoNumber field that has its NewValues property set to Increment to a number other than 1. For a table that contains records, you can also use this procedure to change the next value assigned in an AutoNumber field to a new number.

Create a temporary table with just one field, a Number field; set its FieldSize property to Long Integer and give it the same name as the AutoNumber field in the table whose value you want to change.

In Datasheet view, enter a value in the Number field of the temporary table that is 1 less than the starting value you want for the AutoNumber field. For example, if you want the AutoNumber field to start at 100, enter 99 in the Number field.


Create and run an append query to append the temporary table to the table whose AutoNumber value you want to change.
How?

Note  If your original table has a primary key, you must temporarily remove the primary key before running the append query. Also, if your original table contains fields that have the Required property set to Yes, the Indexed property set to Yes (No Duplicates), or field and/or record ValidationRule property settings that prevent Null entries in fields, you must temporarily disable these settings.

Delete the temporary table.


Delete the record added by the append query.


If you had to disable property settings in step 3, return them to their original settings.
When you enter a record in the remaining table, Microsoft Access uses an AutoNumber field value 1 greater than the value you entered in the temporary table.

Note  If you want to compact the database after changing the starting AutoNumber value, make sure to add at least one record to the table first. If you don\'t, when you compact the database, the AutoNumber value for the next record added will be reset to 1 more than the highest previous value. For example, if there were no records in the table when you reset the starting value, compacting would set the AutoNumber value for the next record added to 1; if there were records in the table when you reset the starting value and the highest previous value was 50, compacting would set the AutoNumber value for the next record added to 51.




Avatar billede kasseper Nybegynder
08. januar 2001 - 13:34 #4
OK, det vidste jeg ikke...Har også tit undret mig over det ;)
Avatar billede horus Nybegynder
08. januar 2001 - 13:58 #5
man skal lære så længe man lever, kasseper :-)
Avatar billede dtn Nybegynder
08. januar 2001 - 14:58 #6
Yes...Tak for hjælpen
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester