Hi GUru's,

Good day!

I have a trouble with the Listview1 when i try to select the category it says "Variable not defined". i put all the necessary references and components. Perhaps i've overlooked some code that needs to be in the project. Can somebody check this for me please...

Here's the code:



Option Explicit

Dim RS_CAT_SEL As New ADODB.Recordset

Private Sub Command1_Click()
If ListView1.ListItems.Count < 1 Then Unload Me: Exit Sub
select_rec
End Sub
Sub select_rec()
With rs_employee_ae ' this code highlights the error
.Cat_Index = ListView1.SelectedItem.ListSubItems(1)
.Text3.Text = ListView1.SelectedItem.ListSubItems(2)
End With
Unload Me
End Sub

Private Sub Command13_Click()
Unload Me
End Sub

Private Sub Form_Load()
RS_CAT_SEL.Open "SELECT * FROM tblCategory ORDER BY CategoryName ASC", CN, adOpenStatic, adLockReadOnly
Load_Rec
End Sub

Private Sub Form_Unload(Cancel As Integer)
Set RS_CAT_SEL = Nothing
End Sub
Sub Load_Rec()
Screen.MousePointer = vbHourglass

Call FillListView(ListView1, RS_CAT_SEL, 3, 1, True, True)

Screen.MousePointer = vbDefault
If ListView1.ListItems.Count < 1 Then Command1.Caption = "&Close"
End Sub

Private Sub ListView1_DblClick()
select_rec
End Sub