Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

default to zero

Status
Not open for further replies.

rsmack

Programmer
Apr 7, 2007
5
US
i use a query to summarize transaction data from several tables for presentation in a form. if a particular table has no entries, because there are not yet any transactions of that type, the query returns null values for that table. these are unusable for calculations, such as totals. is there some way to get a zero value into these queries, or in the controls on the form?
 
How are ya rsmack . . .

In VBE help have a look at the [blue]Nz[/blue] function . . .

Calvin.gif
See Ya! . . . . . .
 
thanks aceman1,

this looks like something i'd have to do for every field. ?
is there a way to do this, uh, globally?


 
rsmack said:
[blue]this looks like something i'd have to do for every field. ?
is there a way to do this, uh, globally?[/blue]
Not sure at this point . . . post this summarizing query/sql . . .

Calvin.gif
See Ya! . . . . . .
 
If you don't want to use the the 0 values, you can use in your SQL statement (or as a filter):

WHERE is not null



Hope I didn't butt in and interfere...

BHT
 
rsmack said:
[blue]this looks like something i'd have to do for every field. ?
is there a way to do this, uh, globally?[/blue]
Not really. Nz is normally used in a calculation where nulls may be expected:
Code:
[blue]   Ans = Nz(field1) + field2
or
   Ans = Nz(field1) + Nz(field2)[/blue]

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top