I have a filter form that displays several combo boxes that the user can select filter options from. Then once they are done selecting, they hit the OK button and that filters my records to show only those that fit the selected criteria.
I use a global variable to store the selection information, then when I open the results form, I pass that variable along with it. If I were sorting by gender here is what my filter code would look like:
***********************************************************
If Not IsNull(cmbGender.Value) And (cmbGender.Value) <> "Any" Then
If Temp = "" Then
Temp = "Gender=""" + cmbGender.Value + """"
Else
Temp = Temp + "and Gender=""" + cmbGender.Value + """"
End If
End If
DoCmd.Close
DoCmd.OpenForm "frmSearchMain", acNormal, , Temp
***********************************************************
So, what I want to add to my filter form is a combo box to see a certain age range (i.e. Birth-1yr, 1-2years). The data that will be used for the age calculation will be coming in as a birth DATE (i.e. 03/05/2000) and is stored in my main table called tblModel. So, I need the age to be calculated before the filtering takes place. I mean, is there a way to do it without doing it in the table and having it able to be sorted?