S
Silvio
I have a List Box populated by an SQL statement based on another combo box
AfterUpdate event (Me.ListServices.RowSource = "SELECT tblServices.ServiceID,
tblServices.DateIn FROM tblAdoptions INNER JOIN tblServices ON
tblAdoptions.AdoptID = tblServices.Adopt_ID WHERE
(((tblAdoptions.Volunteer_ID)=[Forms]![frmServicesToClose]![VolunteerID]));
".
The list is populated with the correct items. So far, no problem.
I then run a code when clicking on an item in the list (on Click event). Of
course, if the list is empty then the code should not run. The problem is
that even when there are items in the list box the code does not run.
Private Sub ListServices_Click()
If Me.ListServices.ItemsSelected.Count = 0 Then
Exit Sub
Else
Me.frmServicesSub.SourceObject = "frmServicesSub"
Me.frmServicesSub.Form.Filter = "[ServiceID] = " & Me.ListServices.Column(0)
Me.frmServicesSub.Form.FilterOn = True
End If
End Sub
The List Box Prop. are as follow:
Row Source Type: Table/Query
Row Source: whatever the SQL code will insert here.
I have used .ItemsSelected.Count = 0 in other form before without any
problem, but in this specific scenario it is not cooperating with me. It
appear like the count is always 0.
Any idea how to solve this problem?
AfterUpdate event (Me.ListServices.RowSource = "SELECT tblServices.ServiceID,
tblServices.DateIn FROM tblAdoptions INNER JOIN tblServices ON
tblAdoptions.AdoptID = tblServices.Adopt_ID WHERE
(((tblAdoptions.Volunteer_ID)=[Forms]![frmServicesToClose]![VolunteerID]));
".
The list is populated with the correct items. So far, no problem.
I then run a code when clicking on an item in the list (on Click event). Of
course, if the list is empty then the code should not run. The problem is
that even when there are items in the list box the code does not run.
Private Sub ListServices_Click()
If Me.ListServices.ItemsSelected.Count = 0 Then
Exit Sub
Else
Me.frmServicesSub.SourceObject = "frmServicesSub"
Me.frmServicesSub.Form.Filter = "[ServiceID] = " & Me.ListServices.Column(0)
Me.frmServicesSub.Form.FilterOn = True
End If
End Sub
The List Box Prop. are as follow:
Row Source Type: Table/Query
Row Source: whatever the SQL code will insert here.
I have used .ItemsSelected.Count = 0 in other form before without any
problem, but in this specific scenario it is not cooperating with me. It
appear like the count is always 0.
Any idea how to solve this problem?