Creating a report based on specific criteria

G

Guest

I am trying to create a report that tells me what training courses employees
have completed. I'm not sure how to query my data to compile a report with
only the specific data I need. For example, I want to pull a report that
lists employees that have completed Access, Excel and SQL courses. How do I
do this so I only get those records and not all of the other data? I know
how to query data but I'm not sure how to set up a front end through a form
that will automatically do this for me.

Thank you.
 
A

Allen Browne

The specifics will depend on your data structure, but the basic idea is to
create a form where the user can enter the limiting criteria. The form will
have a command button to click to open the report. In in the Click event of
the button, you will write code that builds up a string from the user's
criteria, and then you use that string in the WhereCondition of the
OpenReport action.

Now you need some examples.

This simple example shows how to limit the report to just one primary key
value:
http://allenbrowne.com/casu-15.html

This example shows how to limit the report to a date range:
http://allenbrowne.com/casu-08.html

This example shows how to use a multi-select list box to filter a report:
http://allenbrowne.com/ser-50.html

You can combine several of these by adding AND between the phrases. The
whole string has to look exactly like the WHERE clause of a query. In fact,
as you are writing your code, if it is not working you can find out what's
wrong by adding this line:
Debug.Print strWhere
Then copy the results from the Immediate Window (Ctrl+G) into the WHERE
clause of a query (SQL View on Query menu, in Query design.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top