Guest faith Posted June 12, 2006 Share Posted June 12, 2006 Hi,Can anyone help?How do pull the next available id from a table in my database and display this id in a form?Regards,Faith Link to comment Share on other sites More sharing options...
pulpfiction Posted June 12, 2006 Share Posted June 12, 2006 SELECT TOP 1 IDfldnameFROM tblnameORDER BY UserIDfldname DESCThis will give the last/latest id of the table in the DB, and +1 will be the next ID...... Link to comment Share on other sites More sharing options...
justsomeguy Posted June 12, 2006 Share Posted June 12, 2006 You typically don't want to assign an ID before you actually put something in the database. Let them fill out the form, and then tell them what the ID is. If you include the next ID on the form, you might get two people who load the form at the same time and each get the same ID, and then you get a problem somewhere. It's better to let them fill the form out first, and then tell them what their new ID is. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now