Different Address Fields in a Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

I have a query with several tables. Two of the tables are called Encounter
and Encounter History. There are Admit Date fields in each of these tables,
but they are always different. Each table also has an Address field
(Encounter.Address and EncounterHistory.Address). What I want to do is show
one Address field in my query, depending on which table's Address field is
not null. There will never be an address filled in for both table's Address
fields. So I want to either show one or the other address, depending on
which field is not null, in a new field called "Address" in my query. Hope
this was clear and someone can help. Thanks in advance.

Janet
 
JanetF said:
Hello,

I have a query with several tables. Two of the tables are called
Encounter and Encounter History. There are Admit Date fields in each
of these tables, but they are always different. Each table also has
an Address field (Encounter.Address and EncounterHistory.Address).
What I want to do is show one Address field in my query, depending on
which table's Address field is not null. There will never be an
address filled in for both table's Address fields. So I want to
either show one or the other address, depending on which field is not
null, in a new field called "Address" in my query. Hope this was
clear and someone can help. Thanks in advance.

Assuming your query has already taken care of the business of joining
the tables on the appropriate key fields so that the fields from both
tables are available for related records, then you can have a calculated
field like this:

Address: Nz(Encounter.Address, EncounterHistory.Address)
 
Thank you. That worked well.

Janet

Dirk Goldgar said:
Assuming your query has already taken care of the business of joining
the tables on the appropriate key fields so that the fields from both
tables are available for related records, then you can have a calculated
field like this:

Address: Nz(Encounter.Address, EncounterHistory.Address)

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top