Assign Default Value in Fields where = Null (1 Viewer)

Marbinski

Registered User.
Local time
Today, 01:31
Joined
Aug 24, 2004
Messages
45
I have a form with number fields. I am trying to do this with my form:
When the form is loaded it checks the number fields and if they are null I want to populate their value as 0 (zero).

Can someone help me with the proper coding in a generic format:
Field names: Number1, Number2, Number3

Currently I have a QRY that sums these number fields up, and I don't get a total unless all fields are populated. So I'm trying to give the null values a 0 so that I can get my total.

Any help in how to solve this is greatly appreciated. Or if there are alternate ways to do this I'm open to them all.

Thank you in advance.
 

MStef

Registered User.
Local time
Today, 09:31
Joined
Oct 28, 2004
Messages
2,251
:p Hello Morbinski!
In your table click on field "Number1", in Field properties (on the bottom) find "Default Value", set it on 0.
Same for Number2, Number3 fields.
(MStef alias Štef)
 

Marbinski

Registered User.
Local time
Today, 01:31
Joined
Aug 24, 2004
Messages
45
Thanks for the suggestion...

I have tried placing a 0 (zero) in the default value property, but it seems to only work when you create new records.

I already have data in the some, but not all fields. I need to populated the null fields with 0.

Im thinking that I need VB code to do this...i'm gonna keep trying, but if anyone has any more suggestion, i'm all ears. Thanks again.
 

trucktime

Registered User.
Local time
Today, 02:31
Joined
Oct 24, 2004
Messages
556
0 Value

Faster than writing code, you can do a 'find' and 'replace all' on the table for the existing records. Find 'Null' and Replace with '0'.
And set the devault value to '0' on the form which is used to create new records. Trucktime
 

Users who are viewing this thread

Top Bottom