Hello,
I am trying to filter a form based on a listbox selection made by the user:
This works for me ONLY if I have one column in the listbox by which I wish to filter. If I try to filter by more than one field as above, it fails. My listbox has the columns FiscalYear, Num1, Num2. When I specify a filter criteria for my detail section using all the three fields I wish to filter, here is what happens:
-If I select a record from the listbox with a fiscalyear that is different from the fiscal year of the current record, then it jumps to the FIRST record with the fiscal year specified by my listbox selection, which is NOT necessarily the record with the right Num1 and Num2- it just jumps to the first record with the relevant fiscal year.
-If I select a record from the listbox with a fiscalyear that is the same as the fiscal year of the current record that I am on, then it doesn't filter at all- just stays as it is.
Can anyone spot why my piece of code is filtering only on the first part of the criteria and ignoring the other two? This code is sitting in the on-click event of the filter button in the header of the form.
Thank you very much.
I am trying to filter a form based on a listbox selection made by the user:
PHP:
Me.Filter = "[FiscalYear] = " & Me.listbox1.Column(0) & " And [Num1] = " & Me.listbox1.Column(1) & " and [Num2]= " & me.listbox.column(2)
This works for me ONLY if I have one column in the listbox by which I wish to filter. If I try to filter by more than one field as above, it fails. My listbox has the columns FiscalYear, Num1, Num2. When I specify a filter criteria for my detail section using all the three fields I wish to filter, here is what happens:
-If I select a record from the listbox with a fiscalyear that is different from the fiscal year of the current record, then it jumps to the FIRST record with the fiscal year specified by my listbox selection, which is NOT necessarily the record with the right Num1 and Num2- it just jumps to the first record with the relevant fiscal year.
-If I select a record from the listbox with a fiscalyear that is the same as the fiscal year of the current record that I am on, then it doesn't filter at all- just stays as it is.
Can anyone spot why my piece of code is filtering only on the first part of the criteria and ignoring the other two? This code is sitting in the on-click event of the filter button in the header of the form.
Thank you very much.
Last edited: