You have turned on the ServerFilterByForm property. However, when users open the form and select from the combo boxes, the only choices are Is Null and Is Not Null. How do you get the combo boxes to show a list of valid values for that field?
If you turn on the ServerFilterByForm property, your form will open in a special view that turns text boxes into combo boxes. This allows users to define their own server filters at runtime, which are then processed by SQL Server before the record source data is returned to the form. However, you'll often see only the values shown in Figure 14-8 when you expand one of the combo boxes.
Each text box on the form has a FilterLookup property that has three settings:
A combo box list will contain only two items: Is Null and Is Not Null.
A combo box with a full list of values will be created for that text box.
Access will populate the list either with all the values or with only Is Null/Is Not Null, depending on the settings in the Edit/Find tab of the Tools Options dialog shown in Figure 14-9.
Follow these steps to change the database defaults to always show a list of available items when using ServerFilterByForm:
Open the database whose options you want to change.
Choose Tools Options from the menu.
Check the "Records at server" option shown in Figure 14-9.
If you don't want to change this option globally, followthese steps to set the list of values on a form-by-form basis:
In design view, open the form in which you want to enable a full list of values for ServerFilterByForm. Select all the text boxes you want to enable.
Set the FilterLookup property on the Data tab in the properties sheet to Always, as shown in Figure 14-10.
When you open the form to filter records now, you'll see some real data in the combo boxes, as shown in Figure 14-11.
The data to populate the combo boxes must, of course, come from the server. Setting the FilterLookup property for the controls or setting the "Records at server" option for the entire project runs additional queries that populate each combo box with a domain of real values from which the user can choose.
|
Because populating combo boxes with real values entails extra round trips to the server to retrieve the data for the lists, it defeats the purpose of using the ServerFilter property in the first place, so don't overuse this feature. The benefit is that the interface is more user-friendly when the user can select from actual values instead of guessing.
You'll have to evaluate your own applications to determine whether or not the extra data filtering is worth the extra load on the server. If the form would otherwise load a lot of records, and if the lists you are loading aren't too big, you would probably improve performance by using ServerFilterByForm. To be safe, adjust the ServerFilterByForm setting at the control level rather than by setting the database default for the entire project.