G
Guest
I have two main tables: Customers and Tours. Each has its own form.
The Tours table has autonumbered primary key and a column for Customer ID,
in order to keep track of which customer does what.
A query (salutation) uses an IIf statement to combine the separate name
fields from Customers (First1, Middle1, Last1, First2, Middle2, Last2) into a
salutation ("John and Jane Doe", or "David D Doofus and Hellen Keller"). The
query has two colums: Customer ID and Salutation.
-----------
The form I've made is based off of the Tours table. I would like to add a
text box to display the salutation (Name and such) based off of the Customer
ID (which is found in the Tours Table, but is based off of the Customers
Table). I've done it with a query, but when I looked at the SQL code it was
something about 5 lines long (at 1280 x 1024 resolution). Eventually I'd
have to run it against several thousand records, and my guess is that it'd
probably take my processor to school. The database crash was a telltale sign
too.
Three hours later, I'm left wondering: is there any way to write maybe some
SQL code or hopefully something even more simple that does this:
- Read a field to get the Customer ID
- Create a salutation based off of the name fields for the corresponding
Customer
- Display the result in a text field in the form
Sorry for the overly-complicated explanation... and thanks a Million in
advance!
Nick
-----------------------
Code for Salutation Query:
salutation: IIf(IsNull([last2]),[first1] & " " &
[last1],IIf([last2]=[last1],[first1] & " and " & [first2] & " " &
[last1],[first1] & " " & [last1] & " and " & [first2] & " " & [last2]))
The Tours table has autonumbered primary key and a column for Customer ID,
in order to keep track of which customer does what.
A query (salutation) uses an IIf statement to combine the separate name
fields from Customers (First1, Middle1, Last1, First2, Middle2, Last2) into a
salutation ("John and Jane Doe", or "David D Doofus and Hellen Keller"). The
query has two colums: Customer ID and Salutation.
-----------
The form I've made is based off of the Tours table. I would like to add a
text box to display the salutation (Name and such) based off of the Customer
ID (which is found in the Tours Table, but is based off of the Customers
Table). I've done it with a query, but when I looked at the SQL code it was
something about 5 lines long (at 1280 x 1024 resolution). Eventually I'd
have to run it against several thousand records, and my guess is that it'd
probably take my processor to school. The database crash was a telltale sign
too.
Three hours later, I'm left wondering: is there any way to write maybe some
SQL code or hopefully something even more simple that does this:
- Read a field to get the Customer ID
- Create a salutation based off of the name fields for the corresponding
Customer
- Display the result in a text field in the form
Sorry for the overly-complicated explanation... and thanks a Million in
advance!
Nick
-----------------------
Code for Salutation Query:
salutation: IIf(IsNull([last2]),[first1] & " " &
[last1],IIf([last2]=[last1],[first1] & " and " & [first2] & " " &
[last1],[first1] & " " & [last1] & " and " & [first2] & " " & [last2]))