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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update database

Status
Not open for further replies.

iglobal

Technical User
Joined
Nov 23, 2005
Messages
1
Location
US
Hi,

I have two tables one of which is a master table. I have linked(Relationship) one field in the master table with the data table and on that basis, I have made a query which retrieves and displays the value from the master table based on the value in the data table.

However if there is a value in the data table that does not exist in the master table that record is not retrieved. How do I enter a command in the Criteria to ensure that if the value is not found in the master table enter the value "NA". This is because I want to ensure that all records are considered and displayed from the data table.

Would appreciate your input in this matter.

Thanks
 
Use a LEFT JOIN instead of an INNER JOIN and the Nz function.
something like this (SQL code):
SELECT D.FieldA, D.FieldB, Nz(M.FieldX,'NA') As MasterData
FROM tblData AS D LEFT JOIN tblMaster AS M On D.ForeignKey = M.PrimaryKey

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top