|
-
Jul 2nd, 2013, 10:03 AM
#1
Thread Starter
New Member
multiple values in previous comboboxes VB.net
Hi All,
On my form, I have few comboboxes, which are taking data from access table.

The form works like that -
On-Load connection.Open()
after that, user is oblige to choose
1) Account, if he will choose value from combobox, Tower combobox will be enabled (true)
2) Tower, if he will choose value from combobox, Process combobox will be enabled (true)
3) Process, if he will choose value from combobox, User combobox will be enabled (true)
4) rest of comboboxes will be enabled after choosing User. (Those are depends on the user and earlier comboboxes)
My problem is, that Combobox is taking data from table in Access, each has it's own table, because we are uploading data from other form, and our processes are sufisticated, and after choosing first, second, thirds etc. - everything is okay, when employees are choosing it correctly, but if he will choose wrong value, and he would like to change it in previous combobox, the values in it are:

There are only multiple items, and I cannot clear previous items and start once again....
The code for User combobox (as an example). I'm calling it from Form_Load.
Code:
Sub fillUser()
Dim var As String = cbAccount.SelectedItem
Dim var2 As String = cbTower.SelectedItem
Dim var3 As String = cbProcess.SelectedItem
strsql = "Select Distinct * from TimerUser where((TimerAccount like '%" + var + "%') AND (TimerTower like '%" + var2 + "%') and (TimerProcess like '%" + var3 + "%'))"
Dim acscmd As New OleDb.OleDbCommand
acscmd.CommandText = strsql
acscmd.Connection = cn
acsdr = acscmd.ExecuteReader
While (acsdr.Read())
Me.cbUser.Items.Add(acsdr("UserT"))
End While
acscmd.Dispose()
acsdr.Close()
End Sub
Thank you for your help in advance!
Matt
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|