View Single Post
  #3  
Old April 27th, 2010, 02:47 PM posted to microsoft.public.access.reports
Kathy R.[_3_]
external usenet poster
 
Posts: 25
Default building a complicated (to me) string



Marshall Barton wrote:
Kathy R. wrote:
Using Access 2007

I am trying to build a couple of strings from the following
tables/fields. Is it possible to do with this table structure, or would
it be better to add a couple of fields to the tblFamily like FamTitle
(Mr. & Mrs.) and FamFirstName (John and Jane). This would seem to me to
be redundant data though.

tblFamily
FamID (primary key)
FamLastName

tblIndividual
IndID (primary key)
InFamID (foreign key)
InTitleID (foreign key)
FirstName
ContactStatus (primary contact, secondary contact, child, other)

tlkpTitle
TitleID (primary key)
Title (Mr., Mrs., Ms., Dr., etc.)

The strings I would like to build:

For each tblIndividual.InFamID

[Title of primary contact] & “ “ & [Title of secondary contact if
present] & “ “ & [FirstName of primary contact] & “ “ & [FamLastName]

Example with data:
Mr. and Mrs. John Doe (if there is a primary and secondary contact)
Mr. Bob Jones (if there is only a primary contact)


AND by FirstName instead of Title:

[FirstName of primary contact] & “ “ & [FirstName of secondary contact
if present] & “ “ & [FamLastName]

Example with data:
John and Jane Doe (if there is a primary and secondary contact)
Bob Jones (if there is only a primary contact)



I suggest that you rethink the entities that you are trying
to model. It's possible for each member of a household to
have a different last name so the individuals table need a
last name field. Then you can not algoithimically determine
such a thing as a family name do you need some other way to
determine the string you want to construct.

Marshall,
You are correct, and I already do have LastName in the individual table.
If I were addressing a person singly, I would use
[tblIndividual.FirstName] & " " & [tblIndividual.LastName].

However, when addressing a couple I use the FamLastName from the family
table. This most often is the same as the last name of the primary
contact, but I can foresee times when it may not be. Hence the
FamLastName field. So John Doe and Jane Doe-Smith becomes John and Jane
Doe or Mr. and Mrs. John Doe, which are the strings I am trying to build.

Now, I know I'm a bit old-fashioned, and probably out of the loop (been
out of school a good many years); is there a more socially acceptable
way of addressing a couple? Really, I'm not being facetious here. I
tend to have tunnel vision when working on a project so I appreciate any
pointers. You, and many others here, have helped me "sort out my
thinking" more times than I care to mention. Thank you!

Kathy R.