Is it possible to force the Key number to start with my own CUSTOM Number then Auto up one (1) incrementally with every new record? If so how?
Is it possible to force the Key number to start with my own CUSTOM Number then Auto up one (1) incrementally with every new record? If so how?
It is possible to set the start number for autonumber field but preventing gaps in sequence is difficult. If value has meaning to users then autonumber field may not be appropriate for your situation. Generating custom unique identifier is a common topic. DMax() function can be used to generate value for a simple counter.
Nz(DMax("fieldname"),0)+1
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
Whats a good alternative to the fact that every table has as a PRIMARY KEY and Auto Number starting at "1", and incrementing up?
Use a long integer field instead of autonumber and the code June suggested.
Hi
What June is suggesting is the correct way to do this.
The Autonumber would normally be hidden as it should have no meaning to the User.
The the additional Field which you want to show on the Form would always increment by 1 whenever a new record is added.
thanks Ya'll. Where do I place Nz(DMax("fieldname"),0)+1 I'm pretty green at this stuff.
Hi
That would go in the Before Update of the Form
Super. Thanks. I think I'm in over my head.
Related to this, is it OK to have tables with only one (1) column? Therefore only 1 item is the Primary Key?
Related to this, is it OK to have tables with only one (1) column? Therefore only 1 item is the Primary Key?
Sorry I didn't mean to repeat myself.
I don't have a "Long Interger" field available in the drop-down list?
Another dumb question. Every time I open "Create a New Table" the automatic field is already populated with an "ID and AutoNumber". Is it necessary to keep that? Or have it in a Table?
Select "number" in the drop down list then in the properties you'll select the number type, in this case long integer.
It's not necessary. Delete it and set your new number field as primary key.
Why do you need it this way? It's generally advised against and being a beginner you're going to be making things more difficult and possibly introducing a source of errors.
Hi kd2017
I note your comment regarding deleting the Autonumber Primary Key that is always presented when creating a New Table.
Why would you want to delete this??
Quite a lot of developers would disagree with this suggestion.
It may not be necessary but it also doesn't hurt if it's there.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.