Access MS Access: If/Then Report Salutation

Joined
Jun 2, 2005
Messages
22
Reaction score
0
Problem: I'm trying to create reports in MS Access that will automatically address the recipient by their gender (Mr. or Ms.) and then their last name (e.g., Dear Mr. Lastname). I'm trying to do this within a "text box" but I cannot come up with the correct expression. All I can come up with is =([Sex] & " " & [Last])

Any help would be greatly appreciated!

Thanks!
 
If I'm reading this correctly, then you have a field named [sex] that contains the salutation you need (Mr., Ms., etc.) and then [Lastname]. Try:

="Dear " & [Sex] & " " & [Lastname]

that should work, unless I'm reading it wrong, and you're trying to convert the value in sex (i.e. male, female) into your salutation, which makes it more difficult. The above way is definitely the easiest to do it, unless you have a specific reason for doing it another way. So if the value in [sex] is male, female, I would recommend adding a field to your table named [salutation] to put the Mr. or Ms. in and then use

="Dear " & [Salutation] & " " & [Lastname]

Also, make sure you're actually using a "textbox" and not a "label"

Hope this helps.

Amanda
 
Last edited:
aaldridge,

Thanks for responding to my Access quandary. Actually, upon further review, I see that my original post lacks the sufficient specificity that is required in order to solve the problem I'm having.

Where [sex] contains the gender of the addressee, the field entry is simply an "M" (for male) and or a "F" (for female). So the problem is: How do I formulate the correct expression to exchange a "F" for "Ms." and a "M" for "Mr."?

I hope I have provided the necessary information to solve this problem.
 
LimitedAccess said:
aaldridge,

Thanks for responding to my Access quandary. Actually, upon further review, I see that my original post lacks the sufficient specificity that is required in order to solve the problem I'm having.

Where [sex] contains the gender of the addressee, the field entry is simply an "M" (for male) and or a "F" (for female). So the problem is: How do I formulate the correct expression to exchange a "F" for "Ms." and a "M" for "Mr."?

I hope I have provided the necessary information to solve this problem.

The sollution is a esay thing

="Dear " & IIF( [Sex]="F","Ms.","Mr.") & " " & [Lastname]

I hope the example helps you out
 
Problem Solved! A Big Shout of Thanks to cvo-aalst!

cvo-aalst,

Eureka! You did it! Thank you so much! I know the solution was probably very easy and obvious to you; but I have been stumped by this problem for weeks. I'm so grateful I'm thinking of naming my first-born son after you... I can just imagine shouting his name to come in for dinner: "cvo-aalst, it's time to come in and wash up for dinner!" Sigh.

Again, thanks for your help. And a big thanks to PCR for providing this wonderful community that is predicated upon assisting people in need of technical assistance, as well as fellowship.
 
LimitedAccess said:
cvo-aalst,

Eureka! You did it! Thank you so much! I know the solution was probably very easy and obvious to you; but I have been stumped by this problem for weeks. I'm so grateful I'm thinking of naming my first-born son after you... I can just imagine shouting his name to come in for dinner: "cvo-aalst, it's time to come in and wash up for dinner!" Sigh.

Again, thanks for your help. And a big thanks to PCR for providing this wonderful community that is predicated upon assisting people in need of technical assistance, as well as fellowship.

or you can choose from the following names
  1. Goofy
  2. Mickey
  3. Donald
  4. Chip
  5. Dale
 
Back
Top