Good Morning
After making a data filter in the Listview, I see that the filter is carried out in the data base sheet and that the Listview shows only the filtered lines.
But when choosing a row in the Listview, the Textbox is filled with data from another row. As if the filter hadn't been done,
How can I resolve this situation? Thank you for your help.
After making a data filter in the Listview, I see that the filter is carried out in the data base sheet and that the Listview shows only the filtered lines.
But when choosing a row in the Listview, the Textbox is filled with data from another row. As if the filter hadn't been done,
How can I resolve this situation? Thank you for your help.
VBA Code:
Private Sub CASAS_LView_Casas_ItemClick(ByVal Item As MSComctlLib.ListItem)
Dim v_Contador As Integer
Dim v_Ultlinha As Integer
'In listview the first line is 1 but in BD the first line is 3
v_LinhaList = Item.Index + 2
v_Ultlinha = Folha20.ListObjects("BDR_Casas").DataBodyRange.Rows.Count
For v_Contador = 1 To v_Ultlinha
Form_01_Entrada.MultiPage1.Pages(2).CBox_Casas_Obras.Value = Folha20.Cells(v_LinhaList, 2)
Form_01_Entrada.MultiPage1.Pages(2).Casas_TextBox3.Value = Folha20.Cells(v_LinhaList, 3)
Form_01_Entrada.MultiPage1.Pages(2).CBox_Casas_CasasDesc.Value = Folha20.Cells(v_LinhaList, 4)
Next
End Sub
'______________________________________________________________________________________________________
Private Sub CASAS_ComboBox_P02_Casaschange()
Dim v_MPage2 As Variant
Set v_MPage2 = Form_01_Entrada.MultiPage1.Pages(2)
If v_MPage2.ComboBox_P02_Casas.Value = "Codigo" Then
Folha20.ListObjects("BDR_Casas").Range.AutoFilter Field:=2, Criteria1:="=*" & v_MPage2.TextBox_P02_Casas & "*", Operator:=xlAnd
Call CASAS_Listview_Create
End If
If v_MPage2.ComboBox_P02_Casas.Value = "Obra" Then
Folha20.ListObjects("BDR_Casas").Range.AutoFilter Field:=3, Criteria1:="=*" & v_MPage2.TextBox_P02_Casas & "*", Operator:=xlAnd
Call CASAS_Listview_Create
End If
If v_MPage2.ComboBox_P02_Casas.Value = "Casa" Then
Folha20.ListObjects("BDR_Casas").Range.AutoFilter Field:=4, Criteria1:="=*" & v_MPage2.TextBox_P02_Casas & "*", Operator:=xlAnd
Call CASAS_Listview_Create
End If
End Sub