title: How to get Next 4 digit number from Table (Contains 3,4, 5 & 6, digit long numbers)
body: <p>I found a good method of getting the next 4 digit number. 
  <a href="https://stackoverflow.com/questions/7827649/how-to-find-next-free-unique-4-digit-number">How to find next free unique 4-digit number</a></p>
  
  <p>But in my case I want to get next available 4 or 5 digit number.
  And this will change depending upon the users request. Theses number are not a key ID columns, but they are essential to the tagging structure for the business purpose. </p>
  
  <p>Currently I use a table adabpter query. But how would I write a query. 
  I suppose I could do a long iterative loop through all values until I see a 4 digit.</p>
  
  <p>But I'm trying to think of something more efficient. </p>
  
  <pre><code>Function GetNextAvailableNumber(NumofDigits) as Long
  'SQL Code Here ----
  'Query Number Table
  
  Return Long
  
  
  End Function
  </code></pre>
  
  <p>Here's my current SQL:</p>
  
  <pre><code>'This Queries my View
  SELECT MIN([Number]) AS Expr1
  FROM  LineNumbersNotUsed
  
  'This is my View SQL 
  SELECT Numbers.Number
  FROM Numbers
  WHERE (((Exists (Select * From LineList Where LineList.LineNum =  Numbers.Number))=False))
  ORDER BY Numbers.Number;
  </code></pre>
  
  <p>Numbers is the List of All available number from 0 to 99999, basically what's available to use. </p>
  
  <p>LineList is my final master table where I keep the long and all the relevant other business information. </p>
  
  <p>Hopefully this make sense. </p>
  
  <p>Gosh you guys are so tough on new guys. 
  I accidentally hit the enter key, and the question posted and I instantly get -3 votes. </p>
  
  <p>Give a new guy a break will you! Please. </p>