View Single Post
  #2  
Old April 26th, 2010, 08:37 PM posted to microsoft.public.access.reports
Marshall Barton
external usenet poster
 
Posts: 5,361
Default building a complicated (to me) string

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.

--
Marsh
MVP [MS Access]