Report based on Form's Combo box selection

mba_110

Board Regular
Joined
Nov 28, 2012
Messages
80
Office Version
  1. 365
Platform
  1. Windows
Hi everyone,

I am facing some difficulties in producing reports for my database, I have table called payments_table in which I have about 100+ entries for payments to employees for their privilege utilization one employee can have many and other can have one its not predictable it all upon the utilization they have made.

What I need now is I have form called AnnualLeave_Form whenever anyone request new leave we need their history how much they have utilized before to produce this history I need reports I want a command button on form when I click that button this should open report for that employee based on combo box selection on this form which is [Emp_IDCombo] and do not include any other employee’s data in that report.

I have already made the query and necessary tables for these fields I just want the method how can I do this and I would prefer some modification on this but that is not an issue now mainly I need this method.

Here some important reference & relationships for my project database.

Report Name: BenefitUtilization_Report based on UtilizationReport_Query which is having fields [Pmt_ID],[Contract_ID],[Emp_ID],[EmployeeName], and all the necessary Category of payments I have used all this three tables field to create the UtilizationReport_Query in design view.

Relationships: Employees_table connected to Contracts_table via [Emp_ID] and Payments_table connected to Contracts_table via [Contract_ID] all are one-many relationships.
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
Standard method I would follow to achieve this is filtering the report by using Report properties.

1- Open Report Properties dialog.
2- Select Data tab.
3- Record Source must be already UtilizationReport_Query
4- Set Filter On property to be "Yes"
5- Enter following filter text in the Filter property.
Make sure you changed the form name before entering this. It is simply WHERE clause to filter data on your report.

Code:
[COLOR=#333333]Emp_ID=[/COLOR][COLOR=#333333]Forms!FORMNAMEHERE![/COLOR][COLOR=#333333]Emp_IDCombo[/COLOR]


Warning: Form must be open to get this work. It means it is going to work when you click on a button to open the report on the form but it is not going to work if you double click on the report object without Form is opened. Basically,
Forms!FORMNAMEHERE!Emp_IDCombo looking for the data in the specified form in the forms collection.

You can even do the same in the base query, or even via VBA.

Hope this helps.
 
Upvote 0

Forum statistics

Threads
1,221,889
Messages
6,162,627
Members
451,778
Latest member
ragananthony7911

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top