PC Review


Reply
Thread Tools Rate Thread

building a string in a public function

 
 
Kathy R.
Guest
Posts: n/a
 
      25th Mar 2010
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 easier 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.

These are strings that I will use often and in various forms and reports
so I would like to put them into a public function, but I’m not familiar
with how to do that. I figure my first step is to build the strings
properly. Your help would be very much appreciated!

Kathy R.

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 (or would it be better to reference the
tblFamily.FamID?)

[Title of primary contact] & “ “ & [Title of secondary contact if
present] & “ “ & [FirstName of primary contact] & “ “ & [FamLastName]
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 first name instead of title:

[FirstName of primary contact] & “ “ & [FirstName of secondary contact
if present] & “ “ & [FamLastName]
John and Jane Doe (if there is a primary and secondary contact)
Bob Jones (if there is only a primary contact)
 
Reply With Quote
 
 
 
 
Brian
Guest
Posts: n/a
 
      26th Mar 2010
Try
FullName: [Title of primary contact] & iif([Title of secondary contact] <>
Null," " & [Title of secondary contact],"") ...


> 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 (or would it be better to reference the
> tblFamily.FamID?)
>
> [Title of primary contact] & “ “ & [Title of secondary contact if
> present] & “ “ & [FirstName of primary contact] & “ “ & [FamLastName]
> 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 first name instead of title:
>
> [FirstName of primary contact] & “ “ & [FirstName of secondary contact
> if present] & “ “ & [FamLastName]
> John and Jane Doe (if there is a primary and secondary contact)
> Bob Jones (if there is only a primary contact)
> .
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending Tbl to Word using VB coding Public Sub DatabaseXFer() & Public Function CreateWordObj() Andy Microsoft Access 2 25th Nov 2008 01:06 PM
Is KeyValuePair<string,string>.ToString intended as serialization building block? Steve Richter Microsoft C# .NET 2 7th May 2007 09:34 PM
Building a public Internet only workstation =?Utf-8?B?RHVzdGlu?= Microsoft Windows 2000 Group Policy 1 23rd Feb 2005 02:43 AM
Building SQL String For Use In A Function Steve Microsoft Access VBA Modules 3 23rd Oct 2003 09:33 PM
Building an SQL query string to include "&" as part of string Paul Microsoft Access VBA Modules 4 27th Aug 2003 09:33 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:52 AM.