Null value to Zero (1 Viewer)

htadis

Registered User.
Local time
Today, 12:58
Joined
Dec 17, 2014
Messages
61
Hi,

I have a query which i need to get Zero as a result if NULL value. How Can i do this ? Present SQL code is as follows;

SELECT tbl_Impts_main.Bkg_number, Count(tbl_Impts_main.Bkg_number) AS CountOfBkg_number
FROM tbl_Impts_main INNER JOIN tbl_booking ON (tbl_Impts_main.Voyage=tbl_booking.Voyage) AND (tbl_Impts_main.Vessel=tbl_booking.Vessel) AND (tbl_Impts_main.Bkg_number=tbl_booking.Bkg_number)
GROUP BY tbl_Impts_main.Bkg_number
HAVING (((tbl_Impts_main.Bkg_number)=[forms]![frm_Export_data_entry]![bkg_number]));

brgds
 

htadis

Registered User.
Local time
Today, 12:58
Joined
Dec 17, 2014
Messages
61
thanks ! But it did not work. following error msg,

sytax error(Comma) in query expression
 

plog

Banishment Pending
Local time
Today, 02:28
Joined
May 11, 2011
Messages
11,669
Whats the expression you tried?
 

Brianwarnock

Retired
Local time
Today, 08:28
Joined
Jun 2, 2003
Messages
12,701
How can the bkg_number be Null or 0?

I'm suspicious that your problem is not that you have a Null value but that your query is returning nothing.

Try a Left join.

Brian
 

htadis

Registered User.
Local time
Today, 12:58
Joined
Dec 17, 2014
Messages
61
Brian,

yes, some instance my query is returning nothing. at that point i need to show '0' in the count column.

is that possible ?

brgds
 

plog

Banishment Pending
Local time
Today, 02:28
Joined
May 11, 2011
Messages
11,669
Do you have a datasource that contains all the results you want? You can't create values when there are none in the underlying data.

For example, if I had a sales table and wanted to produce a sales total by day for every day in the week and we were closed on Tuesday, I couldn't produce anything for Tuesday from that sales table. However, I could do it if I had another table that had Tuesday in it.

Do you have a datasource that contains all the values you want to report on?
 

Users who are viewing this thread

Top Bottom