473,406 Members | 2,705 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,406 software developers and data experts.

Choose one value from a group of fields?

I'm a definite beginner here, so please excuse me if this has a simple answer.

BACKSTORY
I work for a nonprofit and we are working to automate the gift acknowledgement process. I currently geta file that comes from the Oracle database where we record all of our gifts. The file is imported into Access 2003 and we run a variety of functions from the raw data -- one of the newer desires is to run actual letters. The letters are setup such that the report looks for the letter code in the query and then through a simple IIf statement displays the appropriate text for that letter code. The problem is in the salutation line of the letter (Dear Mr. Doe, where "Mr. Doe" is the field [FORMAL_SALUTATION]). There are 6 salutation fields that come on the Oracle download file -- formal, informal, combined, etc. that may or may not be populated.

DESIRED OUTCOME
I am trying to get the report to look for and display the "best" salutation based on what is available. So if there is data in the [COMBINED_INFORMAL_SALUTATION] field like "Jane and John," I'd want Access to pull that instead of [COMBINED_FORMAL_SALUTATION] -- "Mr. and Mrs. Doe" In other words, informal salutations sit higher on the heirarchy.

SO...
Is there a way to rank fields so that the report pulls only the top ranking populated field? I tried nesting IIf(IsNull statements, but the expression was getting ridiculously long and didn't even work correctly.

Am I trying to swim upstream here or is there some kind of answer?? Thanks to anyone who can help!
Apr 6 '07 #1
1 1553
ADezii
8,834 Expert 8TB
I'm a definite beginner here, so please excuse me if this has a simple answer.

BACKSTORY
I work for a nonprofit and we are working to automate the gift acknowledgement process. I currently geta file that comes from the Oracle database where we record all of our gifts. The file is imported into Access 2003 and we run a variety of functions from the raw data -- one of the newer desires is to run actual letters. The letters are setup such that the report looks for the letter code in the query and then through a simple IIf statement displays the appropriate text for that letter code. The problem is in the salutation line of the letter (Dear Mr. Doe, where "Mr. Doe" is the field [FORMAL_SALUTATION]). There are 6 salutation fields that come on the Oracle download file -- formal, informal, combined, etc. that may or may not be populated.

DESIRED OUTCOME
I am trying to get the report to look for and display the "best" salutation based on what is available. So if there is data in the [COMBINED_INFORMAL_SALUTATION] field like "Jane and John," I'd want Access to pull that instead of [COMBINED_FORMAL_SALUTATION] -- "Mr. and Mrs. Doe" In other words, informal salutations sit higher on the heirarchy.

SO...
Is there a way to rank fields so that the report pulls only the top ranking populated field? I tried nesting IIf(IsNull statements, but the expression was getting ridiculously long and didn't even work correctly.

Am I trying to swim upstream here or is there some kind of answer?? Thanks to anyone who can help!
I'm not sure how you are implementing the Record Source in your Report, but the basic logic would be something like:
Expand|Select|Wrap|Line Numbers
  1. If Not IsNull(Me![Salutation_1]) Then
  2.   'code to use Salutation_1
  3. ElseIf Not IsNull(Me![Salutation_2]) Then
  4.   'code to use Salutation_2
  5. ElseIf Not IsNull(Me![Salutation_3]) Then
  6.   'code to use Salutation_3
  7. ElseIf Not IsNull(Me![Salutation_4]) Then
  8.   'code to use Salutation_4
  9. ElseIf Not IsNull(Me![Salutation_5]) Then
  10.   'code to use Salutation_5
  11. ElseIf Not IsNull(Me![Salutation_6]) Then
  12.   'code to use Salutation_6
  13. Else
  14.   'catch all code
  15. End If
Apr 6 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Lukelrc | last post by:
Hi, I have a dynamically created listbox. I'm trying to get one of the options selected according to a passed value. This is what i have: <select name="txtTheme" id="txtTheme"> ...
6
by: Penny | last post by:
Hi all, I've built a simple search <Form> on a web page that is intended to allow the user to search a record store database. There is a drop down box where the user can choose either 'Artist'...
2
by: Royse | last post by:
Hi Group I'm trying to get the value from a select and place it into some text fields. all these fields have the same name. when a user enters the page all fields are empty Then, when they click...
3
by: Simon | last post by:
Dear reader, I found out a strange behaviour in a query of the type Total (summation query). In case of a normal select query with a criteria setting Is Null for field-A, four (4) records...
12
by: Steve | last post by:
Can the Choose function be used to set the criteria for a field in a query to either "Is Null" or "Is Not Null" based on the value of an option Group on a form? Such as:...
6
by: Bob Darlington | last post by:
I want to use the caption property for fields in a recordset as a condition in a loop. That is, I only want to consider those fields which have captions: For each fld in RecordsetName.Fields If...
9
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a...
1
by: mark | last post by:
Forgive me if this seems like a stupid question but I need help... I'm trying to do a simple online form that emails me the results from a few fields. Here is the code: <form...
5
by: alhomam | last post by:
hi all, i have a table that has the two fileds: Return Date, Extension Time for Return Date i need a query to choose the max date between these two fields eg: if return date = 01...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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...

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.