Auto fill blank fields

si_pooh

New Member
Joined
Sep 23, 2004
Messages
23
Hello,

Does anyone know what is the easiest way to auto fill blank fields with zeros in Access?

Thanks!!!
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK

Will_B

Board Regular
Joined
Mar 4, 2009
Messages
79
If rather than CHANGING blank values to be 0 you simply need to DISPLAY "0" in your forms and reports, then use the function Nz(), called Null-Zero. You can use this function in queries, reports, and forms.

For example, imagine you have a field called "Units". In the QBE grid (i.e., query design mode), change the field name in the grid from "Units" to this formula: Nz([Units],0)

In this example, the Nz() function translates to "If [Units] is null, blank, or 0, return a value of 0". If you wanted to display the phrase "Not available", the formula would be Nz([Units],"Not available"). In your case, you want to display "0".

NOTE: Nz() does not change the value recorded in the underlying table. It simply displays something else than what is there. If you want to actually change the values, you'd need an update query or VBA code within a form that changed blanks to 0.
 
Upvote 0

Forum statistics

Threads
1,191,308
Messages
5,985,904
Members
439,986
Latest member
DaveTee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top