Hello,
In a form, I have a listbox displaying the marks. In the header of the list box I have displayed the value "--All--" based on a union query. So my listbox looks like:
--All--
18
05
13
13
02
I wanted to give the user the ability to select multiple values in the list, So in the properties of the listbox, I selected "Extended" in "Multiple Selection".
To view detailed information about the selected values in the listbox, I saw that I must use VBA code... So I used a Submit button. In this button's event I put:
Where:
lst0: the name of my listbox;
AllQuery: the Query that i want to display if the user clicks on the value: --All--;
CompleteQuery: the query that i want to display if the user clicks on the other values (the marks).
When I click Submit, it takes me to an empty query, ie it didn't display any record ... I know I have errors in my VBA code, but I don't know exactly where.
thanx for ur help.
In a form, I have a listbox displaying the marks. In the header of the list box I have displayed the value "--All--" based on a union query. So my listbox looks like:
--All--
18
05
13
13
02
I wanted to give the user the ability to select multiple values in the list, So in the properties of the listbox, I selected "Extended" in "Multiple Selection".
To view detailed information about the selected values in the listbox, I saw that I must use VBA code... So I used a Submit button. In this button's event I put:
Code:
Private Sub cmd0_Click()
Dim x As Long
For x = 0 To Me.lst0.ListCount - 1
If Me.lst0.Selected(x) = True Then
If [lst0].Value = "--All--" Then
DoCmd.OpenQuery "AllQuery"
Else
DoCmd.OpenQuery "CompleteQuery"
End If
End If
Next x
End Sub
Where:
lst0: the name of my listbox;
AllQuery: the Query that i want to display if the user clicks on the value: --All--;
CompleteQuery: the query that i want to display if the user clicks on the other values (the marks).
When I click Submit, it takes me to an empty query, ie it didn't display any record ... I know I have errors in my VBA code, but I don't know exactly where.
thanx for ur help.