Click here to Skip to main content
15,880,469 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
https://www.dropbox.com/s/x3wvagpujtnm6oq/Table%20Structure%201.png[^]

in the above link is my database structure. Now, how do i get the next unique number in Access database? viz. 3,5.
Posted
Comments
DamithSL 23-May-14 11:18am    
why you need next number? explain your requirement, there may be better alternative approach
agent_kruger 24-May-14 6:22am    
sir, actually if a user inserts the number randomly i want my database (ACCESS) to return the minimum number which is not saved in the database.
agent_kruger 24-May-14 6:22am    
and sir, i dont want the user to stop inserting numbers randomly. Any clue how to do this thing?
DamithSL 24-May-14 6:36am    
can't you make that column auto increment?

1 solution

Don't.

It's a bad idea, because you don't know that the "next number" is the one you will use: Access has pretensions to be a multi user capable database - and it is, it just gives huge amounts of grief if you do use it like that - so if two users get "the next number" only one of them will be able to use it. You should never try to "predict" what a value will be - wait until you create the record and actually use the value - then you have the accurate number.
 
Share this answer
 
Comments
agent_kruger 23-May-14 14:13pm    
no sir, i have managed a way for it but is my question answerable?
[no name] 23-May-14 14:35pm    
Are you kidding? One screenshot with numbered lines? And yes: No your question is not answerable, because it is more an order then a question. Sir!
agent_kruger 24-May-14 6:24am    
sorry sir, if it looked like an order to you but sir my requirement is that "if a user inserts the number randomly i want my database (ACCESS) to return the minimum number which is not saved in the database.".Do you have any idea how to do this?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900