One grad year ONLY for report

T

tjsmags

I created a Grad Year Contact Listing report that shows certain data from my
Contacts table (i.e. first name, maiden name, grad year, address, phone,
email, etc). It prints ALL the grad years and the data that I chose to have
on this report. How do I tell it to print just ONE certain grad year when I
only want data for ONE specific year (i.e. 1982)?

While in Design View of this report I look at the report properties and the
RECORD SOURCE says Contacts (which is the table with ALL data). When I click
on the 3 small dots at the end of this line it invokes the Query Builder.
I've tried to put in Graduating Class Year for FIELD, Contacts (automatically
defaults) for TABLE, Ascending for SORT (hopefully it will list the graduates
in alpha order, which it already does when I view the whole report (I used
Sorting and Grouping and told it to sort last name in ascending order)), and
1982 for CRITERIA...but, this doesn't work as it keeps asking me to enter a
parameter for EACH field I have showing on this specific report (i.e. first
name, maiden name, phone, etc).

What am I doing wrong?
 
E

Evi

The filtering is done before you open the report.

There are several ways to do this:
1. Open the query builder again.
This time, drag *all* the fields onto the query grid.

Under the GradYear column, in the row that says Criteria on the left, enter
1982. Say Yes to saving the changes to the SQL. Your report will now be
filtered.


2. Instead of using the above method, if you are feeling adventerous and
want a more professional finish:


Click on your table, go to Insert, Query, Design View.

Drag just the Grad year field onto the query grid.

Click in the grey area below the grid and click on Properties.

If you have clicked in the right place, one of the Properties will be Unique
Values.
Choose Yes next to that.

You now have a list of all the Grad Years in your database, each grad year
mentioned only once. Save this query as QrycboGradYear.

Open a New (unbound) blank form.

In design view, add a combo box. Choose the option

'I want the combo box to look up the values...'

Choose Queries. Choose QryCboGradYear from the list.

add the GradYear field.

In the Form's design view, click on your combo, click on Properties.
Click on the Other tab.
Next to Name type cboGrad
Click on the Events tab

Next to AfterUpdate choose Event Procedure.
Click just right of that to open a code page.
Above the line End Sub, type


Dim Crit as String
Dim MyReport As String
MyReport = "YourReport"
'replace YourReport with the real name of your report
Crit = "[Grad Year]=" & Me.cboGrad

DoCmd.OpenReport MyReport, acPreview, , Crit


Replace the words YourReport with your report's name (but keep the quote
marks).
When you choose a year, the report will open, showing the students for that
year

Evi
 

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