Generate report based on criteria

xeleron

New member
Local time
Today, 14:21
Joined
Apr 2, 2017
Messages
2
Hello everyone,and thank you for accepting me here.Without further ado,here's my problem.I'm a newbie in access databases and I have been tasked with building one for a small recruitment company.I've made the tables, defined the relationships, the necessary queries and now comes the hardest part.I need to generate some reports based on the data that I have.For example,I have one table called potential customers and another one called employers.When we want to hire someone,there is a junction table which holds the employment data,and I can pull data from that table and generate a report (which is basically a contract).So far so good.The problem is that my employers are split in four categories,and each category has a certain type of contract.Now the question is,how do I make access open a certain report based on a criteria that the employer has? In a "coding language" to me it seems something like this:If employer is type A then open report A,if employer is type B open report B and so on.Thank you for any responses.
 
Are the reports static? In other words, it's just like a leaflet, it does not contain any user specific information like a name and address, things like that.
 
No,they are dynamic,they contain the customers data (all that you said and more).For example I select one person that I add to the employment table,and then I select the employer where I would like to hire the person,and when I press the button "generate employment documents" the underlying code should decide what report should be opened based on what employer I chose. For a better understanding,we are recruiting seasonal workers for agricultural work in Germany and we would like to hasten the document generation process because of the bureaucracy.Thank you for your response.
 
...and when I press the button "generate employment documents" the underlying code should decide what report should be opened...

You should have different reports for the different documents. Then you create a table to associate those report names to employer types.

In the code you have a variable that holds the employer type using a Dlookup (https://www.techonthenet.com/access/functions/domain/dlookup.php) into whatever query you have that can tell you that for the employee. Then you load that document/employer type table into a recordset (https://msdn.microsoft.com/en-us/library/office/ff197799.aspx) using that variable of employer type to filter it. That recordset will contain the name of the reports you need to open, you loop through that recordset opening each report via a DoCmd.OpenReport (https://msdn.microsoft.com/en-us/library/office/ff192676.aspx)
 
I demonstrate the method I use on my website here:-

https://sites.google.com/site/msacc...iple-copies-of-report-with-different-criteria

In the resources section you you can find the link to the original question on AWF I answered. You can follow the thread in which the OP and me thought it through.

The resources are several YouTube videos and a Google presentation.

If you decide to take this route I would be available to answer questions and I would be very interested in any improvements to the documentation you could recommend.

Sent from my SM-G925F using Tapatalk
 

Users who are viewing this thread

Back
Top Bottom