Using Combobox case to run query and generate report

kets0985

Registered User.
Local time
Today, 20:59
Joined
Apr 18, 2015
Messages
11
Hello,

I am create a database to track leave of my team.

I have create the tracker and few reports, however now I want to create a report by applying filters in 2 places, for associate and for leave type or for associate and for joint leave or for associate and for Informed.

I have SQL code which does not work. Can someone please help me how can I select the other paramater with associate name using combox box in form.

Code:
SELECT Leave_Records.[Absent Date], Leave_Records.[Associate Name], Leave_Records.[Absent Day], Leave_Records.[Leave Availed], Leave_Records.[Joint Leave], Leave_Records.[Informed TL], Leave_Records.[Leave Type], Leave_Records.[Leave Applied], Leave_Records.Comments

FROM Leave_Records

WHERE (((Leave_Records.[Associate Name])=Forms!Report_Form!AssociateName) And ((Leave_Records.[Leave Type])=Forms!Report_Form!Leave_Type)) Or
(((Leave_Records.[Associate Name])=Forms!Report_Form!AssociateName) And ((Leave_Records.[Joint Leave])=Forms!Report_Form!Joint_Leave)) Or (((Leave_Records.[Associate Name])=Forms!Report_Form!AssociateName) And ((Leave_Records.[Informed TL])=Forms!Report_Form!Informed));
 
...I want to create a report by applying filters in 2 places...


By 'report' do you mean a Report Object, or are you using it generically to mean a query that opens and you use like a report?

If it is an actual Access Report, then I wouldn't fiddle with parameters in your SQL, but I would apply a WhereCondition to the Report itself when you open it. Check out the documentation for DoCmd.OpenReport:

https://msdn.microsoft.com/en-us/library/office/ff192676.aspx
 

Users who are viewing this thread

Back
Top Bottom