Hello
I have an application that when I open and "Order Number", I have to type the number.
How can I generate automatic secuencial number every time when open "Order Number"
I'll Appreciate you helps
Elvis Cabral
Printable View
Hello
I have an application that when I open and "Order Number", I have to type the number.
How can I generate automatic secuencial number every time when open "Order Number"
I'll Appreciate you helps
Elvis Cabral
And I need to insert into a table that number in field "Order_Number"
Run a SELECT query against the field that has your order numberStore the return in a variable and use that variable in your INSERT INTO query.Code:SELECT MAX(order_number) As NextNumber
In VB6 How do I Generate Automatic Secuencial Numbers?
Please can you do an example please how is vb6
Hack pretty much gave you everything you need, but if you really need to be spoonfed basically do this.
VB Code:
Private Function GenerateNumber() As Integer 'This function, when called, will return the next number you should add to your database. Dim myRecordSet As adodb.Recordset Set myRecordSet = New adodb.Recordset myRecordSet.Open "SELECT MAX(order_num) AS next_num FROM TABLE", myConnection, adopenstatic, adlockoptimistic GenerateNumber = myRecordSet("next_num") + 1 myRecordSet.Close Set myRecordSet = Nothing End Function
Hopefully, you can figure the rest out on your own.
Thanks A lot Veritas
Now my application is generate the numbers
Elvis Cabral