473,588 Members | 2,471 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What's the 'best' was to print a complex calculated field on a report?

I'm printing address labels in a membership database. The rules are
that if both MailingAddress1 and MailingAddress2 are Null, then use
home address, otherwise use mailing address. If address line 1 is
null, don't show a blank line. That sounds simple, and a long IIf
function in the report's query does the job, but it's getting a bit
too long and horrible for me. It may be unreasonable, but I just don't
like big IIfs. Apart from anything else, they are not easy to
maintain.

It gets even bigger, because of family memberships where family
members use the parent address.

It's at the end of this post for those with a masochistic bent. And
that's before I add the stuff to make sure that the parent has an
address ... Uggh.

I could use the Format event to compose the address, but then I'd have
to include all the address fields on the report (Visible = False) and,
apart from anything else, it's kind of difficult to fit 17 extra
fields onto a label-sized report.

I could use a GetMailingAddre ss() function in the report's query, but
they tend to be slow.

I could create a temp table of mailing addresses in the OnOpen event.

I could, er ...,

What do you think?
MailingAddress:
IIf([tblMember.UsePa rentAddress],IIf(IsNull([tblParentMember .MailingAddress 1])
And
IsNull([tblParentMember .MailingAddress 2]),IIf(IsNull([tblParentMember .HomeAddress1]),[tblParentMember .HomeAddress2]
& Chr(13) & Chr(10) & [tblParentMember .HomeCity] & " " &
[tblParentMember .HomeState] & " " &
[tblParentMember .HomePostCode],[tblParentMember .HomeAddress1] &
Chr(13) & Chr(10) & [tblParentMember .HomeAddress2] & Chr(13) & Chr(10)
& [tblParentMember .HomeCity] & " " & [tblParentMember .HomeState] & "
" &
[tblParentMember .HomePostCode]),IIf(IsNull([tblParentMember .MailingAddress 1]),[tblParentMember .MailingAddress 2]
& Chr(13) & Chr(10) & [tblParentMember .MailingCity] & " " &
[tblParentMember .MailingState] & " " &
[tblParentMember .MailingPostCod e],[tblParentMember .MailingAddress 1] &
Chr(13) & Chr(10) & [tblParentMember .MailingAddress 2] & Chr(13) &
Chr(10) & [tblParentMember .MailingCity] & " " &
[tblParentMember .MailingState] & " " &
[tblParentMember .MailingPostCod e])),IIf(IsNull([tblMember.Maili ngAddress1])
And
IsNull([tblMember.Maili ngAddress2]),IIf(IsNull([tblMember.HomeA ddress1]),[tblMember.HomeA ddress2]
& Chr(13) & Chr(10) & [tblMember.HomeC ity] & " " &
[tblMember.HomeS tate] & " " &
[tblMember.HomeP ostCode],[tblMember.HomeA ddress1] & Chr(13) & Chr(10)
& [tblMember.HomeA ddress2] & Chr(13) & Chr(10) & [tblMember.HomeC ity]
& " " & [tblMember.HomeS tate] & " " &
[tblMember.HomeP ostCode]),IIf(IsNull([tblMember.Maili ngAddress1]),[tblMember.Maili ngAddress2]
& Chr(13) & Chr(10) & [tblMember.Maili ngCity] & " " &
[tblMember.Maili ngState] & " " &
[tblMember.Maili ngPostCode],[tblMember.Maili ngAddress1] & Chr(13) &
Chr(10) & [tblMember.Maili ngAddress2] & Chr(13) & Chr(10) &
[tblMember.Maili ngCity] & " " & [tblMember.Maili ngState] & " " &
[tblMember.Maili ngPostCode])))

--
Regards.
Richard.
Nov 13 '05 #1
0 1410

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

Similar topics

3
8508
by: jdph40 | last post by:
I've been given a database and asked to figure out how to sort a report. The report needs to be sorted on a field that is the sum of a field that is calculated in the underlying query. NetSales is calculated in the query; the control source of the text box on the report is Sum(). I need to sort on this. I tried going to the query and creating a new field - TotalNetSales: Sum(), but I get an error message about "cannot have aggregate...
2
2973
by: Norma | last post by:
I have a table with a UPC#, CasesCompleted, TotalHours, standardGoal (pieces per hour) I am generating a report that groups by UPC and figures out production goals. In the Detail section of each UPC, I have a calculated field that looks like this: =sum()/sum()/() This gives me the percentage of production. Each UPC has a different standardGoal. My question is: How can I get an average goal in the Report Footer by
2
5350
by: hhathome | last post by:
In my report I have a calculated DateDiff Field, I also have a calculated count field. I'm trying to get a total of the DateDiff field and dividing it by the count field and I'm having problems -- it seems the calculated field is not storing the data for reuse, maybe -- does anyone have any suggestions? Thanks
1
2480
by: shobhit_shanker | last post by:
Here are the relevant "givens" to my problem... Form: frmLaunchRpt - Text Box: txtAsOfDate - Check Box: chkLogEval - Command Button: cmdLaunchRpt Report: rptEvaluation - Text Box: txtGreen (Percent of items on schedule) - Text Box: txtYellow (Percent of items slightly off schedule)
8
12992
by: werner | last post by:
Hi! I don't want to use eval() in order to parse a user-supplied formula. What alternatives do I have? PHP has no standard functionality for tokenizing or parsing expressions in this regard. Here is a simple example: The user supplies the following formula in string format, "a = (6+10)/4", and the script needs to find out what the value of 'a' is.
3
1452
by: cmd | last post by:
Hi all, I have a calculated control on a report which sums the billing units for each client for each month and for each type of service they received. Is there a way to filter the report to show only clients who have total billing units which are NOT whole numbers? e.g.,
2
1318
by: Hexman | last post by:
Hello All, I'm now getting into the reporting phase of my application development. I need to print not only continuous page reports from a datasource (database, datagridview, listboxes, etc), but also some single page reports which the content is derived from calculated variables, constants, etc. I'm using VB.net Pro so CR seems like the answer, at least for the reports from the datasources. How about for the reports using internal...
3
4737
by: kelley.l.turner | last post by:
Hi all, I am very new to MS Access so please bear with me! I have created a simple calculated field in my data entry form, yet when I view my data table or try to generate a report based on this calculated field, no value is posted. How/where do I get my calculated values to also show up in the tables and reports? Thanks, Kelley
7
3644
by: Sunil Korah | last post by:
Hi, I haven't used access reports much. I have a problem in getting the total of a group. I have 3 fields, ProgName (Program name), Pname (Participant's name) and PCategory (Participant category) PCategory can have values 'SC', 'ST' and 'Others'
0
7929
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7862
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
8228
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
8357
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
7987
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
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3887
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2372
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1196
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.