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
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