Full Version: If value is Null set to 0
UtterAccess Forums > Microsoft® Access > Access Forms
I have a form in which i would like a few controls to be checked for Nulls and if so, reset that control to 0. I have tried something like ... iif([control] is Null, [control] = 0, ) in several different events on the form properties, but no luck...
Thanks in advance.
You need the Nz() function........
Have a look in the help files for more info on Nz()
Most data entry controls have a Default value property that can
be set using the control's property sheet.
Default value is 0, all controls are number fields. Problem is that it is a control which users edit...if they delete a value without filling in a 0..!?? I am getting a circular reference error when i use the nz() formula within the control. I thought there may be a form property that before updating would check for Nulls and fill in 0.
Thanks for the help!
I would use the form's BeforeUpdate event to check the
control's you're concerned about. Just set them to 0 if they
are null.
If isnull(me.text1) then me.text1 = 0
works great! thanks...I swear I tried that exact code in the beforeUpdate event before i posted...oh well, works now!
Thanks again
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.