How are ya tourguy . . . . .
First:
[blue]=[Forms]![frmSearch]![Year]
=[Forms]![frmSearch]![Months][/blue]
The above returns the [blue]bound columns[/blue] of the listboxes, which in your case is more than likely the [blue]primaryKeys[/blue]. So your already extracting the wrong data.
The following won't work as well and for the same reason:
[blue]=[Forms]![frmSearch]![Year].Value
=[Forms]![frmSearch]![Months].value
=[Forms]![frmSearch]![Year].ItemData(Idx)
=[Forms]![frmSearch]![Months].ItemData(Idx)[/blue]
You need to return data from the proper column, and could use the [blue]Column Property[/blue]:
[blue]=[Forms]![frmSearch]![Year].Column(1)
=[Forms]![frmSearch]![Months].Column(1)[/blue]
However, when used in criteria fields, the above will cause an error. I believe its because the [blue]Column Property[/blue] [purple]
is only available to 'VBA' at run time[/purple]. So for this reason try the following (should work!):
Add the following functions to the code module of frmSearch:
Code:
[blue]Public Function qryMonths()
qryMonths = Forms!frmSearch!lbMonths.Column(1)
End Function
Public Function qryYear()
qryYear = Forms!frmSearch!lbYear.Column(1)
End Function[/blue]
Then add the following criteria to the query proper:
Code:
[blue][forms]![frmSearch].[qryMonths]
[forms]![frmSearch].[qryYear][/blue]
Give it a whirl and let me know . . . . .
See Ya! . . . . . .