Compound filter question

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a combo box on my form with the following row source:
SELECT Max(tbl_CalDates.CalDate) AS MaxOfCalDate, tbl_CalDates.MonthNum,
tbl_CalDates.YearNum FROM tbl_CalDates GROUP BY tbl_CalDates.MonthNum,
tbl_CalDates.YearNum ORDER BY Max(tbl_CalDates.CalDate);

When the user selcts an option (the box will display the CalDAte field), I
need to write some code n the AfterUpdate event of the ComboBox to filter the
form based on the fields on the form (MonthNum and YearNum) based on the 2nd
and 3rd field values returned by the combobox selection.

What is the code I'd need to enter into the AfterUpdate event to achieve this?

Thanks in advance!
 
Me.Filter = "MonthNum = " & Me.ComboxName.Column(1) & " And YearNum = "
& Me.ComboxName.Column(2)
Me.FilterOn = True

Just so you know (if you didn't already), columns in a combo box are
numbered 0,1,2,3 and not 1,2,3,4. That's why you use 1 and 2 and not 2
and 3.

You are probably going to want a way to turn off your filter too
Me.FilterOn = False

Hope that helps!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top