473,511 Members | 10,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Table Relationship with Blank Values

mjoachim
33 New Member
I am working on a query that'll find invalid entries. My users enter payroll data into a form and the form only allows them to enter active Cost Code & Job/Sub Job combinations, but often enough they change something after initial entry that results in an invalid combination.

In my query, I have a relationship created between my Data Import(Payroll entries) table and a table of current/active cost codes (see attached). With that relationship, I pull all entries from my Data Import table and only the Cost code field from the Cost Codes table if there is a match. This allows me to see if a match is missing and therefore invalid.

This works great if an entry has a sub job. The problem is if there is no sub job, that field in both tables is blank which doesn't appear to create a match for the relationship.

Is there some way to specify in the relationship that blank should match blank, or add a Nz( ,0) statement of sorts? I don't really want to store a 0 value in the tables, so am seeking out a way to create a match for comparison only.

Thanks!
Attached Images
File Type: jpg Table Relationship.jpg (44.6 KB, 186 views)
Dec 15 '16 #1
2 1247
jforbes
1,107 Recognized Expert Top Contributor
This won't be the most efficient Query, but it will probably do what you want:
Expand|Select|Wrap|Line Numbers
  1. SELECT *
  2. FROM [Data Import] 
  3. LEFT JOIN [Cost Codes] 
  4. ON  [Data Import].[Job Number] = [Cost Codes].JobNumber
  5. AND [Data Import].[Cost Code] = [Cost Codes].CostCode
  6. AND [Data Import].[Sub Job] & '' = [Cost Codes].SubJobNumber &''
I think the same thing can be accomplished with a couple NZ()s:
Expand|Select|Wrap|Line Numbers
  1. Nz([Data Import].[Sub Job], "") = Nz([Cost Codes].SubJobNumber, "")
Maybe you can tell us which works better. =)
Dec 16 '16 #2
mjoachim
33 New Member
I would say they both work equally as well. Slow and inefficient as you expected, but nonetheless accomplishes what I asked.

As always, thank you for your help jforbes!
Dec 16 '16 #3

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

Similar topics

2
7479
by: Fons Roelandt | last post by:
Heelo, I have to Update all fields from a table with the values of a related table, i've tried some querys i found on the internet, but nothing seems to word, i even tried to lookup the value...
3
1605
by: Mason | last post by:
I have a table consisting of people and their attributes. I would like to create a relationship matrix table that records the relationships between the people. So the two tables would look...
0
1847
by: leavandor | last post by:
I am trying to design a query that works with a relationship between a Table and a Query. I am comparing a value in the table with a computed value inside the query. The reason for this is that...
11
8609
by: Alan Silver | last post by:
Hello, I am using this validator on a textbox, and have discovered that if I set the InitialValue property, then the validator correctly fires if the user does not change the initial value of...
3
2869
by: MATTXtwo | last post by:
can people help me how to define table relationship i need some example to understand but make sure it's easy to understand coz my knowledge level still low in access
5
10204
by: titan.nyquist | last post by:
Is there a typical way to create a dictionary (or hash table) with two values, instead of one? Currently, my data structure is TWO dictionaries, each with matching and fully sychronized keys. ...
2
1193
by: genti1 | last post by:
Hi, I am kind of new with Access and I was wandering if someone could help me create a form where I can query data in a table by entering values in that form. For Example: I have a table...
19
4723
by: billa856 | last post by:
Hi, I have to use the table(PRODUCTION) already generated in MS Access in which all fields are of TEXT type.fields like (orderdate,palletno,customercode,itemno,pono,carto n,pcs,totalquantity)Now i...
1
2161
by: zoeb | last post by:
Currently I have a table, and would like the calculate a field in the table by referencing values from another 3 tables. i.e. tblData Index1, Index2, Index3, Value 1 2 3 2...
4
3087
by: PW | last post by:
Hi, I set up a relationship between two tables with the itineraryid fields in both tables: tblDailyItinerary tblDailyMeals I have a form that writes a record to tblDailyItinerary that...
0
7245
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
7144
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
7356
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,...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5671
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,...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.