Results 1 to 2 of 2

Thread: Help

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2009
    Posts
    3

    Help

    I really don't know how to ask this in a single sentence so here is the situation:

    I have a database that has record about an item inventory. Based on the database's primary key which is item_no. If I have 10 records of Items in my database, then item_no should have the last element "10" in the column item_no. The problem is, I want to post in a textbox automatically the next item_no value which is "11". Can someone reply an answer in this thread? thanks!

  2. #2
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Help

    You can use sql such

    select (count(*) + 1) new_id from table1
    or
    select (max(pk_column_name) + 1) new_id from table1

    via ado command/connection object.

    For more information read VB6 ADO Tutorials (can be found in FAQ form, also link is available in DB Forum).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width