473,387 Members | 1,455 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,387 software developers and data experts.

Add in a value for a code that has no record

37
Hello - I am using Access 2007. I created a query in which information on species catch is queried from 3 tables that are joined by trip and haul. If a species was not reported for a unique trip haul then there is no species code or catch value. I was wondering if there is a way to add in the species_code with a 0 for species_kept_weight in the query.
For example:
for species_code 818
for trip 1 haul 1 there was a weight recorded, but for trip 1 haul 2 there was no weight recorded so I would like to add in species_code 818 and a 0 in the species_kept_weight
Right now when I run the query trip 1 haul 2 is not included because there is no record for species_code 818
trip haul species_code species_kept_weight
1 1 818 100
1 2 818 0
I apologize because the names of the data fields are not in a correct Access format, but I did not create the database.
Thank you for any help
Sally
Dec 14 '10 #1
2 1473
MikeTheBike
639 Expert 512MB
Hi

I think, maybe, you need a LEFT JOIN (or RIGHT depending on table order in the query).

You may then want to include the 'Field' below in the query designer.

species_kept_weight: Nz(TableName.species_kept_weight,0)

The Nz() funcion replaces all Null field values with a zero (in this instance).
More info can be found in Help!

Cannot be more specific without seeing the actual query??

HTH

MTB
Dec 16 '10 #2
NeoPa
32,556 Expert Mod 16PB
Mike's on the money there Sally.

Whenever a query includes OUTER JOINs, then there is the potential for records within the incoming data to be missing. I mean the entire record of one of the tables joined in such a way of course, rather than all the incoming data necessarily of course. All of the fields from this missing input record are represented as Nulls in the query. It's not the only way Nulls can appear in your data by any means, but it always indicates a missing value (Null is not a value as such - it is simply a representation of the absence of any value).

Mike's solution of using Nz() then, is a good one to handle such a situation.
Dec 16 '10 #3

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

Similar topics

0
by: Mark | last post by:
Hi All, Win XP, Office XP What I am trying to do is create a login form. The problem is that I am going to set the database up using Access security so that only admin users can read the...
0
by: Mark | last post by:
All, Excuse the re-post but I have found something which works for the UserID but not for the Password (see previous post below). The problem is I don't understand how it works and therefore...
2
by: dskillingstad | last post by:
I'm trying to assign a custom value to a textbox. Here's what I have. I've created a module and "default value" code for a textbox which generates a custom auto-number (yyyy-0000) when a New...
1
by: Eric | last post by:
When I run my script it gives error on the following line: strEmail = Right(strEmail, (Len(strEmail) - 1)) I enclose my code and the sample text file too Thanks,...
1
by: Art | last post by:
Hi, I have a problem with checkbox value on the page connected to MS Access. Ms Access field is: Independent - Data Type: Yes/No My code is: <form name="form" method="post"...
0
by: paulquinlan100 | last post by:
Hi I have a combo-box which is filled with values from a query with the current record ID as a parameter. This all works fine, except the combobox always starts with a blank record so at first...
8
by: kepston | last post by:
I have a situation where I need to record scrap quantities for parts that we sell and parts that are supplied, in a single table. I have a UNION query that combines the part numbers successfully,...
2
by: ringer | last post by:
I use a combo box to select a value from a list but I don't want what is selected to be written to the record. I need each selection of the combo box to correspond to another value that should be...
2
by: Taftheman | last post by:
Hi, I have created a pop up using js and returns a value for me to process. I have got it working. I now need to do it again for another button. The value return will be processed differently. But as...
2
by: iamstuart | last post by:
I have a dropdownlist that is populated with a staffID number depending on the staff members name that is selected from a second dropdownlist. The value from this dropdownlist is then inserted into a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.