Hi friends...

I'm doing Inventory Project...

I'm Having purchase and sales tables...

In purchase table fields are Code, Category, Brand,S.p, Date etc.,

Men, Women, Kids, Accessories are the VALUES STORED IN Category Fields...

In PURCHASE FORM, When i select MEN in Combobox, it has to AUTOMATICALLY allocate(SHOW) CODE(it is also COMBOBOX) numbers from 1-200, women form 201-400, kids from 401-600, Accessories from 601-1600.

No other numbers to be allocated to SPECIFIED VALUE...

i.e for MEN NUMBERS LIKE 225, 555 888 SHOULD not to be allocated...

I.e In Purchase table, i have to Generate Numbers Automatically...

Please help me...

Thanks in advance...

Waht do you mean i didn't understand do you want to generate autonumber on your form and then want to store in database??????????

Dear,

I think you are not understanding what i said...

It's ok...

in PURCHASE form, when i select MEN in COMBO BOX, the LAST stored VALUE(CODE) for MEN have to be added with 1 and to be shown in the combo box...

i.e if the last value(Stored in DATABASE) of MEN is 25, next time when i want to add another detail, CODE for MEN has to come 26 in FORM...

i.e when i select CATEGORY as MAN in PURCHASE form, it has to search in DB, it has to take last value(Highest value) of CODE for MAN, and has to show the NEXT value in COMBO BOX in form...

i need help... plz help...


Thanks in advance...

Dear friends...

I got the solution for my question... sorry i troubled u...

Try
cn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\Inventory.mdb;Persist Security Info=False")
'Dim sqlQRY As String = "SELECT * FROM Purchase WHERE Code= (" + Me.CmbPrdCde.SelectedItem + ");"
str = "SELECT * FROM Purchase WHERE Category='" + CmbCtgry.Text + "'"

Dim da As OleDbDataAdapter = New OleDbDataAdapter(str, cn)

Dim ds As DataSet = New DataSet

da.Fill(ds, "Purchase")

Dim dt As DataTable = ds.Tables("Purchase")

Dim row As DataRow

For Each row In dt.Rows
CmbCde.Text = row("Code") + 1

Next row
If ds.Tables("Purchase").Rows.Count = 0 Then
MessageBox.Show("Sorry No Record Found Please Try Again!", " You Software name ", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If

cn.Close()
Catch ex As OleDbException
MessageBox.Show("Customer Not found" + ex.Message)
End Try

Thanks for providing support...

This question has already been answered. Start a new discussion instead.