问题
I have a very simple table with about 10 columns. I have set up a search form with all unbound fields and a couple of combo boxes that reference the table on 2 columns, one for each combo box. I have been using this for these two types of criteria in my query:
1) Like "*" & [Forms]![Contract Search]![ContractName] & "*"
2) Like IIf(IsNull([Forms]![Contract Search]![Amount]),"*",[Forms]![Contract Search]![Amount])
Basically i have the first one setup to match anything in the text box and if left blank return all. The second one I have setup to match exact or if null return all. I want to use the second criteria logic for the combo boxes.
This works fine for the text boxes and check boxes but when I use the same format for the combo box it doesn't display anything on the query.
Combo Box Criteria I am using:
IIf(IsNull([Forms]![Contract Search]![Project]),"*",[Forms]![Contract Search]![Project])
even a simple criteria:[Forms]![Contract Search]![Project] does not work with the combobox.. if i convert it to a text box it works..
The values show up fine in the combo box in the search form, but they dont seem to pass the selection to the query. I dont understand what I am doing wrong. These are all unbound controls. I am using Microsoft Access 2010.
来源:https://stackoverflow.com/questions/25120980/ms-access-search-form-need-to-pass-values-from-unbound-combo-box-to-query