#Num! Help

G

Guest

I have a text box with =[Text1]/[Text2]&"%" in it and when i go to regular
view it gives me a #Num! in it. The two text boxes have time in them like
0:00 but when I put anything in them but 0:00 the #Num! goes away and gives
me the percent i needed. What am i doing wrong?
 
A

Allen Browne

Try setting the Control Source of your text box to:
= IIf([Text2] <> 0 AND Not IsNull([Text1]), CDbl([Text1])/CDbl([Text2]),
Null)

Set its Format property to:
Percent
and make sure its Name is not the same as the name of any of your other
fields.

This solution:
- Avoids type mismatch issues by typecasting to double.
- Avoids division by zero error.
- Avoids errors with Null.
- Returns a number (not text), and formats it as percent.

It is assumed that these fields contain a Time component only. If they
contains both a date and time, the results may not match what you expect,
and you will probably need to use TimeValue() on both of them in the
expression.
 
J

Jeff Boyce

When Access says "#Name?", it can't figure out what you are talking about.
This usually happens when someone re-types the name of a field, instead of
selecting it (or using copy/paste).

Regards

Jeff Boyce
Microsoft Office/Access MVP

cbr said:
I keep getting a #NAME? where it should be current date any sugestions

oxicottin said:
I have a text box with =[Text1]/[Text2]&"%" in it and when i go to
regular
view it gives me a #Num! in it. The two text boxes have time in them
like
0:00 but when I put anything in them but 0:00 the #Num! goes away and
gives
me the percent i needed. What am i doing wrong?
 

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