473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Skip a report record?

I have a report that joins 12 external tables, and works great.
However, there is a time when I wish to skip printing a particular
record.

Background: The 12 tables all have the same fields, and are "unioned".
One field is [statusbox] and one is [Office]. The report GROUPS the
list by Office.

The logic I wanted to do in the report detail is:

If me.count>1 AND me.[statusbox] = "NO CHANGES" then SKIP THIS RECORD

(in the above code, me.count is counting the number of records in the
group [Office], and [statusbox] is one field within that group).

Now I know I could set up the querry to ignore records who's
[statusbox] field = "NO CHANGES", but I only want to do this if there
is more than one record in this group. If the sole record in the group
happens to be the one who's [statusbox] = "NO CHANGES" then that is
fine, and this record should be printed.

Example one:

Office statusbox
---------------------------
RSO bla bla bla
RSO bla bla bla bla
RSO NO CHANGES
MGT bla bla
MGT bla bla
POL NO CHANGES

in this example, the report will NOT show the 3rd record, because there
are 3 records in the RSO group, AND this 3rd record has the words "NO
CHANGES". However, the last record would print, becuase it only has 1
record.
Thanks!

Pete

Aug 7 '06 #1
5 4860
Why not just omit them from the query running behind the report? You
don't want reports making complex decisions for you, it's very
inefficient.

Clownfish wrote:
I have a report that joins 12 external tables, and works great.
However, there is a time when I wish to skip printing a particular
record.

Background: The 12 tables all have the same fields, and are "unioned".
One field is [statusbox] and one is [Office]. The report GROUPS the
list by Office.

The logic I wanted to do in the report detail is:

If me.count>1 AND me.[statusbox] = "NO CHANGES" then SKIP THIS RECORD

(in the above code, me.count is counting the number of records in the
group [Office], and [statusbox] is one field within that group).

Now I know I could set up the querry to ignore records who's
[statusbox] field = "NO CHANGES", but I only want to do this if there
is more than one record in this group. If the sole record in the group
happens to be the one who's [statusbox] = "NO CHANGES" then that is
fine, and this record should be printed.

Example one:

Office statusbox
---------------------------
RSO bla bla bla
RSO bla bla bla bla
RSO NO CHANGES
MGT bla bla
MGT bla bla
POL NO CHANGES

in this example, the report will NOT show the 3rd record, because there
are 3 records in the RSO group, AND this 3rd record has the words "NO
CHANGES". However, the last record would print, becuase it only has 1
record.
Thanks!

Pete
Aug 7 '06 #2

ManningFan wrote:
Why not just omit them from the query running behind the report? You
don't want reports making complex decisions for you, it's very
inefficient.
I'd love to.. I just do not know how to do it.

Peter

Aug 8 '06 #3
OK, solved it! I used a HAVING statement and it works perfect!

Pete

Aug 8 '06 #4
RATS.. I didn't solve it.

See my recent post, I can't figure out how to count the records
properly.

Clownfish wrote:
OK, solved it! I used a HAVING statement and it works perfect!

Pete
Aug 8 '06 #5
"Clownfish" <cl*********@yahoo.comwrote in news:1155031539.596366.54240@
75g2000cwc.googlegroups.com:
RATS.. I didn't solve it.
This query selects the records from your example data (entered into Test4):

SELECT * FROM Test4 T4
LEFT JOIN
[SELECT Count(*) AS Occurrences, First(Test4.office) AS Office
FROM Test4
GROUP BY Test4.Office]. SQ
ON T4.Office=SQ.Office
WHERE SQ.Occurrences>1

The []. alias syntax is unforgiving. It must be very precise.

You can avoid it by saving

SELECT Count(*) AS Occurrences, First(Test4.office) AS Office
FROM Test4
GROUP BY Test4.Office

as SubQueryforSuchAndSuchReport.

Then the query SQL can be:

SELECT * FROM Test4 T4
LEFT JOIN
SubQueryforSuchAndSuchReport SQ
ON T4.Office=SQ.Office
WHERE SQ.Occurrences>1

--
Lyle Fairfield
Aug 8 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Bob Quintal | last post by:
I have a report that prints a single record. Normally it's enter one record, then print it. This works great. New requirement: Each record needs to be printed to an individual ..pdf file from...
4
by: Sami | last post by:
I hope someone will tell me how to do this without having to do any VB as I know nothing in that area. I am a rank beginner in using Access. I have created a database consisting of student...
3
by: Melissa | last post by:
What specifically causes the Format event of a report's section to fire? Thanks! Melissa
4
by: wattar | last post by:
Hi all, I will briefly tell you about the structure of my databse, and then will ask you my question. I have a database for project tracking, with a table for projects, and some other tables...
4
by: Bruce | last post by:
Surely someone has done this before, and I am guessing there is a simple solution that is eluding me. I have a simple report based on a recordset. For each record there is a field (RecNum) that...
4
by: Jana | last post by:
Hi! I have an Access 97 report based on tables linked to an SQL back end. The report has 5 subreports in it (unfortunately unavoidable due to the nature of the report) and performance is quite...
3
theBond
by: theBond | last post by:
When i am printing report through crystal report then it skip some on the pages in between. i.e. if i print 10 pages then it print page1 and page2 then it skip page3 and print page4 and again same...
11
by: radink | last post by:
Hey All, I have a report that I would like to show a word on based on if a field is checked in a form. For example. The form has a check box called Fee. If that is checked, I want the word Paid...
6
by: Oko | last post by:
I'm currently developing an MS Access Data Project (.adp) in MS Access 2002. One of the reports within the DB uses data that is Dynamic and cannot be stored on the SQL Server. To resolve this, I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.