PDA

View Full Version : Combobox from one form filters another combobox in another form



Arvin.Amaro
04-03-2015, 10:23 AM
Hi guys, Need a lil bit of help here. I have two comboboxes each is placed in different form. I have frmlogin with cbousername, this combobox shows list of names located in sheet(login).
Private Sub UserForm_Initialize() 'Names cbousername.RowSource = "login!a2:a16" End Sub While frmcoaching has the cboagent. What Im trying to do is if for example I chose Bryan from cbousername, when frmcoaching loads cboagent will show list of names under Bryan. I tried this code but it is not working.
If frmlogin.cbousername = "Bryan" Then cboagent.RowSource = "login!f2:f9" ElseIf frmlogin.cbousername = "Daryll" Then cboagent.RowSource = "login!g2:g9" ElseIf frmlogin.cbousername = "Adrian" Then cboagent.RowSource = "login!h2:h9" ElseIf frmlogin.cbousername = "Lee" Then cboagent.RowSource = "login!i2:i9" ElseIf frmlogin.cbousername = "Chris" Then cboagent.RowSource = "login!j2:j9" ElseIf frmlogin.cbousername = "Erjan" Then cboagent.RowSource = "login!k2:k9" ElseIf frmlogin.cbousername = "JB" Then cboagent.RowSource = "login!l2:l9" ElseIf frmlogin.cbousername = "Jim" Then cboagent.RowSource = "login!m2:m9" ElseIf frmlogin.cbousername = "Krissta" Then cboagent.RowSource = "login!n2:n9" ElseIf frmlogin.cbousername = "Mond" Then cboagent.RowSource = "login!o2:o9" ElseIf frmlogin.cbousername = "Carlo" Then cboagent.RowSource = "login!p2:p9" ElseIf frmlogin.cbousername = "Marvin" Then cboagent.RowSource = "login!q2:q9" ElseIf frmlogin.cbousername = "Dan" Then cboagent.RowSource = "login!r2:r9" ElseIf frmlogin.cbousername = "Darwin" Then cboagent.RowSource = "login!s2:s9" ElseIf frmlogin.cbousername = "Louie" Then cboagent.RowSource = "login!t2:t9" End If Hope somebody can help me out.