Hello Brains Trust
With the help of the users on this forum I have learnt more than I could have done on my own about using and coding Access, however I am stumped by this problem that I have been working on for some time.
I have a form that is used to display search results based on some triple state check boxes on the form.
The form is based on a query containing the required fields to display on the form.
On opening, the form displays all unfiltered results of the query. The user then uses the check boxes to filter out data that they do or do not want to see.
It all works fine on fields that are based on text boxes on the underlying table. However I've been asked to add a text field to the search form so that users can add that to their filtered search results.
I created an expression in the query that gives me a NO if the field in the table is empty, or a YES, if the field in the table has a value, thinking that I could use a triple state check box on the calculated field. This is where I am having my issue.
Code:
DrillTrue: IIf(IsNull([DrillHead]),"No","Yes")
I want the triple state checkbox called Drill on the form to work on the expression DrillTrue, to show all values that are YES if checked, all values that are NO if unchecked otherwise show all results if the checkbox is greyed out (no value).
This is the SQL code for the query.
Code:
SELECT Customers.CompanyName, [CustomerMachineComponents].MachineNo, [xMachineModel].[MachineModel], [CustomerMachineComponents].[PurchDate], [CustomerMachineComponents].[AirAssistHead], [CustomerMachineComponents].[Pop-UpPins], [CustomerMachineComponents].[MaterialOnLoader], [CustomerMachineComponents].[MaterialOffLoader], [CustomerMachineComponents].[MaterialLifter], [CustomerMachineComponents].MaterialLifter, [CustomerMachineComponents].[ICSCamera], [CustomerMachineComponents].Mister, [CustomerMachineComponents].MisterType, [CustomerMachineComponents].[DrillHead], IIf(IsNull([DrillHead]),"No","Yes") AS DrillTrue
FROM [xMachineModel] INNER JOIN (Customers INNER JOIN [CustomerMachineComponents] ON Customers.CustomerID = [CustomerMachineComponents].CustomerID) ON [xMachineModel].ModelID = [CustomerMachineComponents].ModelID
WHERE ((([CustomerMachineComponents].[AirAssistHead])=IIf(IsNull([Forms]![frmAdvancedSearch]![AirAssist]),[AirAssist Head],[Forms]![frmAdvancedSearch]![AirAssist])) AND (([CustomerMachineComponents].[Pop-UpPins])=IIf(IsNull([Forms]![frmAdvancedSearch]![PopUpPins]),[Pop-Up Pins],[Forms]![frmAdvancedSearch]![PopUpPins])) AND (([CustomerMachineComponents].[MaterialOnLoader])=IIf(IsNull([Forms]![frmAdvancedSearch]![OnLoader]),[MaterialOnLoader],[Forms]![frmAdvancedSearch]![OnLoader])) AND (([CustomerMachineComponents].[MaterialOffLoader])=IIf(IsNull([Forms]![frmAdvancedSearch]![OffLoader]),[MaterialOffLoader],[Forms]![frmAdvancedSearch]![OffLoader])) AND (([CustomerMachineComponents].[MaterialLifter])=IIf(IsNull([Forms]![frmAdvancedSearch]![Lifter]),[MaterialLifter],[Forms]![frmAdvancedSearch]![Lifter])) AND (([CustomerMachineComponents].[ICSCamera])=IIf(IsNull([Forms]![frmAdvancedSearch]![Camera]),[ICSCamera],[Forms]![frmAdvancedSearch]![Camera])) AND (([CustomerMachineComponents].Mister)=IIf(IsNull([Forms]![frmAdvancedSearch]![Mist]),[Mister],[Forms]![frmAdvancedSearch]![Mist])))
ORDER BY Customers.CompanyName;
I am hoping that someone may be able to offer a solution or point me in the right direction.
Thanking you in advance for your time.