473,761 Members | 2,293 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Sorting 'n grouping records in a report = easy. How about trying to sort 'n group those same recs fed to a Function???

MLH
I have a challenge...

In a table I call tblStuff4Letter s with 3 fields:
[Cust_ID], [RecipientName] and [BodyText]. I have
a report called rptOutboundCorr espondence that feeds
off this table. Sorting & grouping is turned on in
that report - sorted first on [Cust_ID] (ascending)
then on [RecipientName] (ascending). Of course,
there are more supporting fields in the table. The
above 3 are the significant fields for this discussion.

The report basically outputs letters from customers
to recipients. If tblStuff4Letter s has 4 records with
[Cust_ID]=1 and 2 of the records have [RecipientName]
values of "Microsoft" and the other 2 have "Compaq"
as their [RecipientName] values, the output will be
1 letter to Microsoft with 2 paragraphs [[BodyText])
and 1 letter to Compaq with 2 paragraphs.

On a routine basis, the data in tblStuff4Letter s gets
blown away and repopulated with thousands of records
that result in hundreds of letters from customers to
companies with anywhere from 1 to a dozen paragraphs
each. There is 1 record in tblStuff4Letter s for each
paragraph that needs printing. Thus, 1000 records in
tblStuff4Letter s could result in 100 letters containing
10 paragraphs each being printed. It could be 200 letters
with 5 paragraphs each or 1 letter with 1000 paragraphs.

I do these print jobs in a batch. My current method
is to print all the paper, separate the individual
letters and mail them. I'm tired of mailing them and
I've told the customers that I'm now going to convert
my procedures from snail mailing hard copies to emailing
files. Trouble is, I don't know how to create the 100
files (in the above example). I only know how to print
the 1000 paragraphs. I know how to create 1 big file of
all the letters containing all 1000 paragraphs. But I
don't know how to make Access create a file for just
the [BodyText] paragraphs for the first [Cust_ID] /
[RecipientName], then have it make a file for the next
[Cust_ID] / [RecipientName] combo & the next & the next
and so on... I could just send EVERYBODY the 1 great
big file & have 'em cut 'n paste the relatively few
letters pertaining to them personally - tossing the
rest (which would be the bulk of the file). But that's
not gonna make the customers happy. Does anyone have
any suggestions?

Lets just say, for argument's sake, that I've got a
function MTF - which stands for MakeTheFile that I can
feed chunks of tblStuff4Letter s to (one letter at a time)
and that Function MTF() will take care of making the file,
how do I go down through the table grabbing just those
records needed for each letter - a "chunk" of records
being those with a unique [Cust_ID] / [RecipientName]
combo.
Nov 12 '05 #1
1 2610

Just an idea, but it should work.

Open recordset with SQL = "SELECT [Cust_ID], [RecipientName] FROM
tblStuff4Letter s GROUP BY [Cust_ID], [RecipientName]"

Loop through recordset.

For each record open report in design view, set Filter to [Cust_ID] =
rst![Cust_ID] AND [RecipientName] = rst![RecipientName], set FilterOn
To True. Close and Save form then export to .rtf file with an
appropriate name.

This should produce a seperate .rtf file for each [Cust_ID],
[RecipientName] combination
--
Posted via http://dbforums.com
Nov 12 '05 #2

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

Similar topics

3
5228
by: Mat N | last post by:
Hi, I've been trying to work out how to create a report based on crosstab query for which the number of fields is variable. For example in a situation where you show customer billing by year in the following format: Customer 2000 2001 2002 Bill 103 10 205 Frank 12 50
8
3537
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At the moment the printed output is usually going to Word. It's turning into an unholy mess, because I'm having to prepare umpteen different Word templates, and the queries that drive them, depending on what events a course has.
1
2510
by: Megan | last post by:
quick summary: i'm having problems trying to group fields in a report in order to calculate percentages. to calculate percentages, i'm comparing the results from my grouped fields to the totals. first, let me say that this is a really long post. i wasn't sure how much information/ background to provide, so i thought more was better than less. i tried to delineate certain areas so that it would be easy to peruse my posting and find...
1
2474
by: Jon via AccessMonster.com | last post by:
Hi Guys, My "Sorting and Grouping" in my report looks like this: Field/Expression Sort Order sID Ascending ((= Project Name Ascending User *** Ascending ((= rID Ascending
4
9298
by: Marie | last post by:
My report has a text field named ItemNum. Most records have a value for ItemNum. I set Grouping And Sorting to sort ascending on the ItemNum field. The records where ItemNum is Null appear at the top of the list in the report. I want the records that have a value for ItemNum to be first in the report and sorted ascending and I want the records where ItemNum is Null to be at the end of the report. How do I do this? Thanks for all help! ...
2
2838
by: Tim Marshall | last post by:
Access 2003. The situation is this: I have a "criteria selection form" in which there are a many different criteria, mostly displayed as combo and text boxes in which a user can enter stuff, click an associated button and that criteria becomes part of the where clause of a select statement. The selected criteria is stored on a hidden form and when the user is ready to run their report(s), a button action goes through the hidden form and...
3
5420
by: Jimmy | last post by:
Is there a way to sort/group a report based on the second column of a combo box, i.e. the text associated with the primary key number?
8
2205
by: sara | last post by:
Hi - I have looked at all posts and tried both Allen Browne's Report Sorting at run Time ( Select Case Forms!frmChooseSort!grpSort Case 1 'Name Me.GroupLevel(0).ControlSource = "LastName" Me.GroupLevel(1).ControlSource = "FirstName") ..... And another post that was OrderByOn = True and setting the sort Order.
5
2398
by: Gumbyu | last post by:
Hello all, I have been working on this issue for about a week and still cannot get anything to group or sort. At this point, I just want to be able to group a report by using a 'checkbox' on a form. This form is for reporting and I need to be able to group using different columns in my report. The first question I have is, should the following grouping code be placed in the reportopen sub (of the report) or in the onclick sub (of the form)....
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9811
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.