Hi,
I want to display a name, that is divided by three fields:
Title (Prof., Dr.)
Firstname
Lastname
Unfortunately, some data don't have title and/or firstname (they all have lastname). So, the logic is:
Titel Firstname
----- ---------
if 0 0 -> then displays only lastname
if 0 1 -> then displays firstname + ' ' + lastname
if 1 0 -> then displays title + ' ' + lastname
if 1 1 -> then displays titel + ' ' + firstname + ' ' + lastname
0 represents empty fields, 1 represents non-empty fields. I hope this table is understandable.
I have written a code like this in the design query:
(The table is called "archiv unternehmen". It's German.)
So, it's nested if. But I don't get what I want. Some came up something like JohnDoe, or 1-2 spaces at front. Can somebody check if my code is correct? Or maybe have a better approach?
Another question, is it possible that an access table contains whitespaces, so it looks empty to human eyes but actually not?
Thanks for any help.
Andre
I want to display a name, that is divided by three fields:
Title (Prof., Dr.)
Firstname
Lastname
Unfortunately, some data don't have title and/or firstname (they all have lastname). So, the logic is:
Titel Firstname
----- ---------
if 0 0 -> then displays only lastname
if 0 1 -> then displays firstname + ' ' + lastname
if 1 0 -> then displays title + ' ' + lastname
if 1 1 -> then displays titel + ' ' + firstname + ' ' + lastname
0 represents empty fields, 1 represents non-empty fields. I hope this table is understandable.
I have written a code like this in the design query:
Code:
Name: When([archiv unternehmen].[title]=''; When([archiv unternehmen].[firstname]='';[archiv unternehmen].[lastname];[archiv unternehmen].[firstname] & ' ' & [archiv unternehmen].[lastname]);When([archiv unternehmen].[firstname]='';[archiv unternehmen].[title] & ' ' & [archiv unternehmen].[lastname];[archiv unternehmen].[title] & ' ' & [archiv unternehmen].[firstname] & ' ' & [archiv unternehmen].[lastname]))
So, it's nested if. But I don't get what I want. Some came up something like JohnDoe, or 1-2 spaces at front. Can somebody check if my code is correct? Or maybe have a better approach?
Another question, is it possible that an access table contains whitespaces, so it looks empty to human eyes but actually not?
Thanks for any help.
Andre