Hello Access Friends
I have a simple membership applicaion. I have imported legacy data, and all is working well. Now I'm working on output,letters(from Access report) to members. My problem arises with the creation of the greeting in the correspondence. The membership record can hold the name of two individuals.
If there is only one person in the record the greeting would be "Dear" prefix lname fname. At first I simply checked to see if lname2 was empty in order to determine if there was just one person in the record. That did not work because many records only record the first name of the "spouse". So the test for a single person is not empty fname2.
Pertinent fields Prefix, Lname, Fname ,Prefix1, Lname1, Fname1
There are four tests for the three possible greetings
1 Empty [Fname2] -> Mr John Smith
2 empty [Lname2} and not empty [Fname2] -> Mr & MRs John Smith
3 [Lname2] =[Lname] -> Mr & MRs John Smith
4 not empty[Lname2] and [Lname2] <> [Lname] -> Mr John Smith and Mr James Jones
Greet: IIf(IsNull([fName2]),[prefix]+" " & [Fname]+" " & [Lname]) works fine for test 1.
Can (should) I nest iif's deep enough to cover all four instances?
Is there a better way to do this? If VBA where would th code be placed? I don't have experience with VBA.
Any & all thoughts appreciated
Al
I have a simple membership applicaion. I have imported legacy data, and all is working well. Now I'm working on output,letters(from Access report) to members. My problem arises with the creation of the greeting in the correspondence. The membership record can hold the name of two individuals.
If there is only one person in the record the greeting would be "Dear" prefix lname fname. At first I simply checked to see if lname2 was empty in order to determine if there was just one person in the record. That did not work because many records only record the first name of the "spouse". So the test for a single person is not empty fname2.
Pertinent fields Prefix, Lname, Fname ,Prefix1, Lname1, Fname1
There are four tests for the three possible greetings
1 Empty [Fname2] -> Mr John Smith
2 empty [Lname2} and not empty [Fname2] -> Mr & MRs John Smith
3 [Lname2] =[Lname] -> Mr & MRs John Smith
4 not empty[Lname2] and [Lname2] <> [Lname] -> Mr John Smith and Mr James Jones
Greet: IIf(IsNull([fName2]),[prefix]+" " & [Fname]+" " & [Lname]) works fine for test 1.
Can (should) I nest iif's deep enough to cover all four instances?
Is there a better way to do this? If VBA where would th code be placed? I don't have experience with VBA.
Any & all thoughts appreciated
Al