473,406 Members | 2,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Join value from another Table to a Query

I need to join the various address field of a client and take the value to Invoice (Report). Customers PO Box, Address, City, Country & Tel number is joined together and is taken to report from single column. Here city and country value are numbers and the original value is in two other tables (namely Emirate_Master & Country_Master). The values are joined together before taking to report to avoid blank space if any value is Null)

When I join the values, everything comes right, except city and country. Instead of city and country name, the respective numbers come in the result.

The formula used in the query is given below;
Expand|Select|Wrap|Line Numbers
  1. AddressLine: 
  2. (IIf([PO Box] Is Null
  3.    ,""
  4.    ,"PO Box # " & [PO Box] & ", ") & 
  5.       (IIf([Address] Is Null
  6.          ,""
  7.          ,[Address] & ", ") & 
  8.             (IIf([Emirate] Is Null
  9.                ,""
  10.                ,[Emirate] & ", ") & 
  11.                   (IIf([Country/Region] Is Null
  12.                      ,""
  13.                      , [Country/Region])))))
Apr 26 '14 #1
1 1227
zmbd
5,501 Expert Mod 4TB
You have said nothing about your table structure.

Nether [Emirate] nor [Country/Region] can be a primary key if they ar null, or you have something very wrong in how you have set up your table relationships. That may your first issue as making a join between tables is easiest on the primary key. (> Database Normalization and Table Structures. )

You can ofcourse join on other fields and this is what you will need to do, is join on these fields back to the tables that have the text version then include the fields in the query with the text and use those instead of the numeric fields.

Also, all of this IIF() nastyness doesn't need to be done to avoid the extra spaces, read thru this article AND pay attention to the conversation about the propogation of NULLS:
What Is Null?
You'll find the method we use to joing things like:
[Name_first][Name_MI][Name_Last] when field [Name_MI] may be null without an extra space.
Apr 26 '14 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Marc | last post by:
Hello, I'm not an expert in SQL, if you could help me for that little problem: I had tree simple tables with their fields: IdClient, Param IdSale, IdClient, Param IdParam, Value
2
by: terence.parker | last post by:
I am often faced with the dilemma of whether to use a JOIN query across three tables in order to grab a bunch of results - or whether to create another table to represent what I want. The latter is...
6
by: Sven Pran | last post by:
Probably the answer is there just in front of me only awaiting me to discover it, but: 1: I want to build a query that returns all records in one table for which there is no successful "join"...
7
by: rcamarda | last post by:
I wish to build a table based on values from another table. I need to populate a table between two dates from another table. Using the START_DT and END_DT, create records between those dates. I...
2
by: mmitchell_houston | last post by:
I'm working on a .NET project and I need a single query to return a result set from three related tables in Access 2003, and I'm having trouble getting the results I want. The details: ...
5
by: OldBirdman | last post by:
I am attempting to assign a .RowSource to a ListBox using an SQL statement. I want to build the SQL statement "On-the-Fly", based on values in several controls on the form. I would like to restrict...
1
HaLo2FrEeEk
by: HaLo2FrEeEk | last post by:
I've got a table where I store tips for a challenge. Its structure is this: tip_id, challenge_id, user_id, ip_address, tip_date, tip_text The tips can be voted up or down, I store vote data in...
8
by: Shannon Mathews | last post by:
Ok trying to explain... 1. I have a tblMain that holds the master list of all my checks. 2. I'm currently using a make table query "qryCheckHoldingListCreateTbl" to get a list of all the checks...
8
by: Sandra Walsh | last post by:
Hello - I have a local table in my database called t_CompanyData that holds a subset of the fields in another table called dbo_INT_AUX_LISTING. dbo_INT_AUX_LISTING is a linked table via an...
2
by: chetu19800 | last post by:
i need to add manual value by coding and also add name depended on queary how can set row source type are both value and table/query in combo box. example : i like add ALL and other value fill...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.