Unique Combobox Problem

murty473

New Member
Joined
Aug 10, 2011
Messages
8
Hi,

I'm receiving an error when I just selected one of the combobox from a drop-down list on the userform. Comboboxes are unique and combined to each other. I mean, they are populating according the previous one's result.

Name of the comboboxes: Turkcell1-Turkcell2-Turkcell3-Turkcell4-Turkcell5

My comboboxes are linked to: Process-SubProcess-KPIType-KPIName-Unit

Please find my codes below regarding to this macro.

When I select one of them let's say just KPIName, I receive the following error. I don't receive an error when I just select Process(first one) and Unit(last one)

Run-time error: '3021':
Either BOF or EOF is True, or the current record has been deleted.Requested operation requires a current record.

I appreciate for your help.

Kind Regards

Code:
Private Sub Turkcell1_Change()
If Turkcell1.Value = Empty Then Exit Sub
Turkcell2.Column = con.Execute("select distinct([SubProcess]) from [LookupLists$] where [Process]='" & Turkcell1.Text & "'").getrows
End Sub
Private Sub Turkcell2_Change()
If Turkcell2.Value = Empty Then Exit Sub
Turkcell3.Column = con.Execute("select distinct [KPIType] from [LookupLists$] where [SubProcess]='" & Turkcell2.Text & "' and [Process]='" & Turkcell1.Value & "'").getrows
End Sub
Private Sub Turkcell3_Change()
If Turkcell3.Value = Empty Then Exit Sub
Turkcell4.Column = con.Execute("select distinct [KPIName] from [LookupLists$] where [KPIType]='" & Turkcell3.Text & "' and [SubProcess]='" & Turkcell2.Value & "' and [Process]='" & Turkcell1.Value & "'").getrows
End Sub
Private Sub Turkcell4_Change()
If Turkcell4.Value = Empty Then Exit Sub
Turkcell5.Column = con.Execute("select distinct [Unit] from [LookupLists$] where [KPIName]='" & Turkcell4.Text & "' and [KPIType]='" & Turkcell3.Value & "' and [SubProcess]='" & Turkcell2.Value & "' and [Process]='" & Turkcell1.Value & "'").getrows
End Sub
Private Sub Turkcell5_Change()
End Sub

Code:
Private Sub UserForm_Activate()
Set con = CreateObject("adodb.connection")
con.Open "provider=microsoft.jet.oledb.4.0;data source=" & ThisWorkbook.FullName & ";extended properties=""excel 8.0;hdr=yes"""
Turkcell1.Column = con.Execute("select distinct ([Process])  from [LookupLists$]").getrows
Turkcell2.Column = con.Execute("select distinct ([SubProcess])from [LookupLists$]").getrows
Turkcell3.Column = con.Execute("select distinct ([KPIType])  from [LookupLists$]").getrows
Turkcell4.Column = con.Execute("select distinct ([KPIName])  from [LookupLists$]").getrows
Turkcell5.Column = con.Execute("select distinct ([Unit])  from [LookupLists$]").getrows
End Sub
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Forum statistics

Threads
1,224,516
Messages
6,179,231
Members
452,898
Latest member
Capolavoro009

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top