Blank Values are not show as result in query

dhen21dx

Board Regular
Joined
May 10, 2013
Messages
165
Hello,

I have created a query to get the only equal on material and plant, however, the result does not include Null value from plant, can somebody help me how to deal with it?

Table 1
MaterialPlantDest
CDFSSUSHK
CDFSSHK
CDFSSPHHK
Table 2
MaterialPlantQtyDateCreatedBy
CDFSSUS
6​
1/21/2021​
User1
CDFSS
9​
8/29/2021​
User1
CDFSSTW
10​
12/2/2021​
User1
INNER JOINMaterialTable 1
Table 2
PlantTable 1
Table 2
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
65,496
Office Version
  1. 365
Platform
  1. Windows
If you want to return ALL values from one table, and return the matches to another, you do not want to do an INNER JOIN. An INNER JOIN will only return matches.
You want a LEFT JOIN (or sometimes known as a LEFT OUTER JOIN). This link will show you how to do that: Access - Create Queries with Outer Joins

Then, if you want to return a 0 in the unmatched rows instead of a blank space, you can use the NZ function, i.e.
Rich (BB code):
UpdatedQty: Nz([Qty],0)+0
See: MS Access: Nz Function
 

dhen21dx

Board Regular
Joined
May 10, 2013
Messages
165
Hi Joe,

I just want to show the item equals to each other, however, blanks or null in plants are not showing in the result.
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
65,496
Office Version
  1. 365
Platform
  1. Windows
I just want to show the item equals to each other, however, blanks or null in plants are not showing in the result.
OK, if you only want the matching ones, then you would just use the standard Inner Join.
I think that maybe you want to join on BOTH the Material and Plant fields. But if that is so, then you may have an issue with the records that are missing "Plant" values". You may need to use the NZ function to populate empty "Plant" field in order to complete the join.

If that is the case, then I would just Join on the Material field, and then add a condition in your WHERE clause that looks something like this:
VBA Code:
WHERE Nz([Table1]![Plant],"ZZZ") = Nz([Table2]![Plant],"ZZZ")

If you still cannot figure out how to write it, please show us an example of EXACTLY how you want the results of the query to look, based on your data samples of the two tables.
 

Forum statistics

Threads
1,176,013
Messages
5,900,883
Members
434,857
Latest member
lowiscoetzee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top