Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Maiden/Last Name Query

Status
Not open for further replies.

rmm

IS-IT--Management
Dec 26, 2001
2
US
I have a database with two separate fields for Maiden Name and Last Name which includes both spouses. I would like my query to do the following:

Table Data:
FirstName MaidenName LastName Address
Bob Smith 123 Main
Jan Walters Smith 123 Main

Query Results
Name Address
Bob Smith 123 Main
Jan Walters-Smith 123 Main

I know to use [FirstName]&" "&[MaidenName]&"-"&[LastName] but how do I do the if [MaidenName]=Null then [FirstName]&" "&[LastName]? What would be the statement in Access? Thank you for your help.
 
Hi!

Try this:

IIf(IsNull([MaidenName]) = True, [FirstName] & " " & [LastName], [FirstName]&" "&[MaidenName]&"-"&[LastName])

I haven't tested it, but it should give you a start.

hth Jeff Bridgham
bridgham@purdue.edu
 
Thank you! Thank you! Thank you!

A friend and I worked on it a few months ago and I had forgotten how to do it. I really need to start using Access on a daily basis. I fell off this bike because I forgot how to ride it.

Thank you Jeff!
Robyn
 
Hi Robyn!

No problem, I hope it really helps! :)

Jeff Bridgham
bridgham@purdue.edu
 
What about the case of the spouse providing the same name in both fields?

Query Results
Name Address
Bob Smith 123 Main
Jan Smith-Smith 123 Main

Terry M. Hoey
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top