By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,404 Members | 2,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,404 IT Pros & Developers. It's quick & easy.

autonumber without autonumber

P: 32
Without using autonumber, how can i generate the next available record number to appear in the primary key field on a data entry form?

For example, i want to add a new supplier, but the primary key "supplier_id" is just set to number. I dont want to use autonumber.

When i goto this form i wish it to look at the last record number, add 1 to it, then prepopulate the id field
Mar 16 '07 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,366
Without using autonumber, how can i generate the next available record number to appear in the primary key field on a data entry form?

For example, i want to add a new supplier, but the primary key "supplier_id" is just set to number. I dont want to use autonumber.

When i goto this form i wish it to look at the last record number, add 1 to it, then prepopulate the id field
DMax("supplier_id", "Table Name") + 1
Mar 16 '07 #2

Denburt
Expert 100+
P: 1,356
DMax("supplier_id", "Table Name") + 1

I have had a few people request such methods from me in the past and I really suggest you avoid doing so unless there is no way around it or you know this will never be used by more than 1 person at a time.

O.K. Warning aside I have used date/time as a reference date/time can be converted to a number and should resolve your issue and prevent future issues. There are a number of ways that this can be done and I believe there is a function that can do this (cant seem to find it right now), so the number can be converted back to a date time. This can be usefull so that you can see when a record was created etc.

I will keep looking
Mar 16 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.