Users request eliminating 0 in field default on form and IsError returns #Num

S

saraqpost

I have 2 irritating issues, and I'm hoping someone can help. I haven't
found a solution in Help or searching posts.

1. Field displays #Num or #Div/0 on new record. Calcs correctly after
data is entered.
The controlsource of the field is below. I thought the IsError would
eliminate the #num or #div/0??

=IIf(IsError(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100,"",
(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100)


2. The users end up typing 600 when they mean to type 60. Is there
any way to get rid of that default 0?
I have 2 fields on this form that are impacted:

Pack
Quantity

Table default is 0; form default is null
But when you tab into the field or click in it, you see 0. The users
end up typing 600 when they mean to type 60. Is there any way to get
rid of that 0 showing up?

Thanks
sara
 
C

Carl Rapson

I have 2 irritating issues, and I'm hoping someone can help. I haven't
found a solution in Help or searching posts.

1. Field displays #Num or #Div/0 on new record. Calcs correctly after
data is entered.
The controlsource of the field is below. I thought the IsError would
eliminate the #num or #div/0??

=IIf(IsError(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100,"",
(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100)


2. The users end up typing 600 when they mean to type 60. Is there
any way to get rid of that default 0?
I have 2 fields on this form that are impacted:

Pack
Quantity

Table default is 0; form default is null
But when you tab into the field or click in it, you see 0. The users
end up typing 600 when they mean to type 60. Is there any way to get
rid of that 0 showing up?

Thanks
sara

1. I don't think that's how IsError works. You probably should just check
[txtTotalRetail] to see if it's not zero. You could do it this way:

=IIf(([txtTotalRetail]=0),"",(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100)

2. The form is still picking up the default value from the table. You'll
need to remove the default in the table as well.

Carl Rapson
 
S

saraqpost

I have 2 irritating issues, and I'm hoping someone can help. I haven't
found a solution in Help or searching posts.
1. Field displays #Num or #Div/0 on new record. Calcs correctly after
data is entered.
The controlsource of the field is below. I thought the IsError would
eliminate the #num or #div/0??
=IIf(IsError(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100,"",
(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100)

2. The users end up typing 600 when they mean to type 60. Is there
any way to get rid of that default 0?
I have 2 fields on this form that are impacted:
Pack
Quantity

Table default is 0; form default is null
But when you tab into the field or click in it, you see 0. The users
end up typing 600 when they mean to type 60. Is there any way to get
rid of that 0 showing up?
Thanks
sara

1. I don't think that's how IsError works. You probably should just check
[txtTotalRetail] to see if it's not zero. You could do it this way:

=IIf(([txtTotalRetail]=0),"",(([txtTotRetail]-[txtTotCost])/[txtTotRetail])­*100)

2. The form is still picking up the default value from the table. You'll
need to remove the default in the table as well.

Carl Rapson- Hide quoted text -

- Show quoted text -

Thanks, Carl.

I got the first to work. The funny thing is, I'd used that *solution*
in a report and don't know why I didn't think to apply the same to the
form. Hopefully next time! Anyway, it works now.

On the second - is there any danger in removing the default value on
the table? These are all numeric fields, and some are optional. Am I
setting myself up for problems in the future if the default is gone?
Will the fields on a new record still default to 0 or will they be
Null?

I'm worried that if they're Null, I'll have to nz all over the
place....Can be done, but may be more work (I am the sole "programmer"
here) than the benefit to the user. I'm still quite new at this, but
I have learned to think ahead - don't do something without considering
its impact (where possible) on the future.

Your thoughts? (And anyone else, too?)
Sara
thanks
 
C

Carl Rapson

I have 2 irritating issues, and I'm hoping someone can help. I haven't
found a solution in Help or searching posts.
1. Field displays #Num or #Div/0 on new record. Calcs correctly after
data is entered.
The controlsource of the field is below. I thought the IsError would
eliminate the #num or #div/0??
=IIf(IsError(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100,"",
(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100)

2. The users end up typing 600 when they mean to type 60. Is there
any way to get rid of that default 0?
I have 2 fields on this form that are impacted:
Pack
Quantity

Table default is 0; form default is null
But when you tab into the field or click in it, you see 0. The users
end up typing 600 when they mean to type 60. Is there any way to get
rid of that 0 showing up?
Thanks
sara

1. I don't think that's how IsError works. You probably should just check
[txtTotalRetail] to see if it's not zero. You could do it this way:

=IIf(([txtTotalRetail]=0),"",(([txtTotRetail]-[txtTotCost])/[txtTotRetail])­*100)

2. The form is still picking up the default value from the table. You'll
need to remove the default in the table as well.

Carl Rapson- Hide quoted text -

- Show quoted text -

Thanks, Carl.

I got the first to work. The funny thing is, I'd used that *solution*
in a report and don't know why I didn't think to apply the same to the
form. Hopefully next time! Anyway, it works now.

On the second - is there any danger in removing the default value on
the table? These are all numeric fields, and some are optional. Am I
setting myself up for problems in the future if the default is gone?
Will the fields on a new record still default to 0 or will they be
Null?

I'm worried that if they're Null, I'll have to nz all over the
place....Can be done, but may be more work (I am the sole "programmer"
here) than the benefit to the user. I'm still quite new at this, but
I have learned to think ahead - don't do something without considering
its impact (where possible) on the future.

Your thoughts? (And anyone else, too?)
Sara
thanks

Yes, the value will be Null instead of zero if you remove the default.
You'll have to determine which is more trouble - the users accidentally
leaving the zero in the field or you (as the programmer) having to remember
to test for Null. I don't know of any other alternative. One thing, you
could also test the magnitide of the number in the BeforeUpdate event of the
control and see if it's reasonable. For example, if the number should always
be less than 100, then 600 probably means they didn't overwrite the zero
default.

Carl Rapson
 
S

saraqpost

I have 2 irritating issues, and I'm hoping someone can help. I haven't
found a solution in Help or searching posts.
1. Field displays #Num or #Div/0 on new record. Calcs correctly after
data is entered.
The controlsource of the field is below. I thought the IsError would
eliminate the #num or #div/0??
=IIf(IsError(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100,"",
(([txtTotRetail]-[txtTotCost])/[txtTotRetail])*100)
2. The users end up typing 600 when they mean to type 60. Is there
any way to get rid of that default 0?
I have 2 fields on this form that are impacted:
Pack
Quantity
Table default is 0; form default is null
But when you tab into the field or click in it, you see 0. The users
end up typing 600 when they mean to type 60. Is there any way to get
rid of that 0 showing up?
Thanks
sara
1. I don't think that's how IsError works. You probably should just check
[txtTotalRetail] to see if it's not zero. You could do it this way:
=IIf(([txtTotalRetail]=0),"",(([txtTotRetail]-[txtTotCost])/[txtTotRetail])­­*100)

2. The form is still picking up the default value from the table. You'll
need to remove the default in the table as well.
Carl Rapson- Hide quoted text -
- Show quoted text -

Thanks, Carl.

I got the first to work. The funny thing is, I'd used that *solution*
in a report and don't know why I didn't think to apply the same to the
form. Hopefully next time! Anyway, it works now.

On the second - is there any danger in removing the default value on
the table? These are all numeric fields, and some are optional. Am I
setting myself up for problems in the future if the default is gone?
Will the fields on a new record still default to 0 or will they be
Null?

I'm worried that if they're Null, I'll have to nz all over the
place....Can be done, but may be more work (I am the sole "programmer"
here) than the benefit to the user. I'm still quite new at this, but
I have learned to think ahead - don't do something without considering
its impact (where possible) on the future.

Your thoughts? (And anyone else, too?)
Sara
thanks

Yes, the value will be Null instead of zero if you remove the default.
You'll have to determine which is more trouble - the users accidentally
leaving the zero in the field or you (as the programmer) having to remember
to test for Null. I don't know of any other alternative. One thing, you
could also test the magnitide of the number in the BeforeUpdate event of the
control and see if it's reasonable. For example, if the number should always
be less than 100, then 600 probably means they didn't overwrite the zero
default.

Carl Rapson- Hide quoted text -

- Show quoted text -

Hey! I've learned something and remembered it! I think that you
confirmed what I had guessed (feared?). It's far better for the
company for the users to look at what they're doing (and me test for
reasonable limits), than for me to constantly have to trap for Nulls.

Thanks -
sara
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top