Data selection and checkboxes

DigitalS27

Registered User.
Local time
Today, 12:25
Joined
Sep 13, 2013
Messages
13
Hi guys,

We have a small lab database where we insert the results of a water plant test. The results can be either Before treatment or After treatment.

And it can be treated numerous times a year.

I have created form with a drop-down box to select the customer and a button to show reports for the selected customer.

But I also want to add 2 check boxes: a Before treatment and After treatment box. And also add a date range.

So when selecting to view reports our users can select a date range example:

01/01/2013 to 01/10/2013 and a check box so users can select if the results to be displayed are Before or After treatment.

Can somebody please help me with the VBA code for this ? It will be much appreciated.

Thank you.
 
Good news is that, if you want what I think you want, no VBA code is needed. Just make a select query that pulls the fields you want from the table of results, and at the end of the SQL file add the line:
Code:
WHERE  tablename.customer = Forms!formname.dropdownboxname AND  IIf(Forms!formname.beforetreatmentcheckname=true,  tablename.treatmentfield="Before treatment", IIf(Forms!formname.aftertreatmentcheckname=true,   tablename.treatmentfield="After treatment", tablename.treatmentfield=Like"*") AND (tablename.datefield BETWEEN Forms!formname.StartDate AND Forms!formname.EndDate)
With a bit of fiddling this should work for you, I believe.
 

Users who are viewing this thread

Back
Top Bottom