Link to home
Start Free TrialLog in
Avatar of LillyC
LillyCFlag for United Kingdom of Great Britain and Northern Ireland

asked on

How to replace a blank field with a zero in a query in Access 2010

I have a query that returns a value if an invoice is overdue, and it shows a blank if not.

I would like to replace the blank field with a zero, can anyone help?
Avatar of Scott McDaniel (EE MVE )
Scott McDaniel (EE MVE )
Flag of United States of America image

You can use the Nz function:

SELECT Nz(YourFieldName, "0") AS SomeField FROM SomeTable
Avatar of LillyC

ASKER

This doesn't seem to work Scott, my field is called InvoiceDate and if its 'blank' I want to force a '0'?
post the sql statement of your query
my field is called InvoiceDate and if its 'blank' I want to force a '0'

You cannot mix dates with a string. So what are you actually doing?

/gustav
The "0" date is Dec 30, 1899.  Remember dates are not stored as strings.  Dates are stored as double precision numbers with the integer porting being the number of days since the "0" date and the decimal as the fraction of time since midnight.
ASKER CERTIFIED SOLUTION
Avatar of Helen Feddema
Helen Feddema
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of LillyC

ASKER

Thank you :)
There is no need to check for a "valid date" as a date field only can hold either a valid date or - if the field allows - Null.
So just check for Null if that is your case - what you actually are trying to do is still a secret.

/gustav
Right, if it is a Date field.