Topic: Can a Search Button have AND NOT something

Hello,
I have provided an application to a customer which they use to log all the technical work that comes in. The company assigns the job to a staff member who deals with it. Each service job record has a ComboBox dropdown field called Status and the user changes this as the job is updated. The values in this ComboBox are from a Dictionary table called Status. The user enters the status entries in the Status table to suit there needs and all works well. Currently they have values Closed, Completed, Open, and Started.
Once a job is invoiced in a separate invoicing software, the user sets the Status for the job to 'Completed'.
On the form that shows the list of service jobs, there are dropdown ComboBoxes for Job Status, Customer, and a Date field and these are all used on a Search button. Eg the user could Search for records with status Open for Customer name ABC.
In day to day use, the user would like to bring up the list of service jobs but not show jobs that have been invoiced as most of the interest is in the jobs that are still open. My question is how to do this, keeping in mind that the user has control over the Status field entries in the dictionary table. I am thinking about a CheckBox on the Service Job record labelled 'Invoiced'. If I do that, can that be used as part of the search button. Then the search would be along the lines of Status=OPEN and Customer=ABC and InvoiceCheckBox NOT Checked.
Does that make any sense at all. Ideally, I think it would be good if there was a CheckBox that can be included in the search button where the user selects whether to include invoiced records or not.
Any ideas would be appreciated.
Thanks, David

Re: Can a Search Button have AND NOT something

Hello David,


Yes, what you are asking for makes sens smile


Have a look at this slightly modified example from Dmitry.


I added a checkbox to the form, linked it to the "smoker" boolean field in the employees table and linked it to the search button. No code needed.


- Checked, the checkbox returns only smokers
- Unchecked, the checkbox returns non smokers
- Grayed, the checkbox returns both


Hope this helps


Cheers


Mathias

Post's attachments

Attachment icon CheckBox-Search.zip 355.12 kb, 394 downloads since 2018-01-29 

I'm a very good housekeeper !
Each time I get a divorce, I keep the house

Zaza Gabor

Re: Can a Search Button have AND NOT something

Hello Mathias,
thank you for your good work again. I can incorporate that into my project. I did not know about the AllowGrayed feature.
Thank you and regards,
David

Re: Can a Search Button have AND NOT something

Hi David, Salut Mathias,
Just a thought, but there are a couple of reasons why you might want to filter the 'invoiced' status using a combobox instead of a checkbox (make sure the 'first item empty' property is set to 'true' (the default) which is the equivalent of the checkbox's 'allow grayed').
1.  if you are already using comboboxes for 'job status' and 'customer', the user might find it more consistent rather than a mix of comboboxes and checkboxes.
2.  checkbox only ever allows for 3 conditions (in your example, 'not invoiced', 'invoiced' or either).  What if you have other conditions (eg 'part invoiced', 'queried invoice' etc)?  This may not be relevant for you at the moment but might 'future proof' your application if the requirement changes at some point (as they always do - LOL!).
If the preferred option is 'not invoiced' then (as in the attached example from Mathias), set the default index for the combobox to be '1' on both Form1 and FrmEmployee.
Regards,
Derek.

Post's attachments

Attachment icon checkbox suggestion.zip 359.63 kb, 436 downloads since 2018-01-29 

Re: Can a Search Button have AND NOT something

Hello Derek,
thank you for the ideas and the project. Both from you guys are excellent. I will be seeing the customer at the end of the week and tell them there are options. Really appreciate the input from you both.
Regards,
David