473,414 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Aarrrgh!! Why won't this work?

I have a text box on a form whose control source is

=IIf([txtPercentTotal]>1,"Total is Over 100%; Please
Adjust",IIf([txtPercentTotal]<1,"Total is UNDER 100%; Please
Adjust","Total is 100%"))

I have also tried
=IIf([txtPercentTotal]>1,"Total is Over 100%; Please
Adjust",IIf([txtPercentTotal]<1,"Total is UNDER 100%; Please
Adjust",IIf([txtPercentTotal]=1,"Total is 100%")))
and

=IIf([txtPercentTotal]=1,"Total is
100%",IIf([txtPercentTotal]>1,"Total is Over 100%; Please
Adjust",IIf([txtPercentTotal]<1,"Total is UNDER 100%; Please
Adjust")))

The problem is that I don't get the "Total is 100% message" and the
total is 100%. I can adjust one of the 14 figures and correctly get
the OVER and UNDER messages, but the Equals message won't work.

I've added the values in Excel. Each field is defined as double. I
typed in the values that are being added right into the table (and
they will eventually come from a form). I have expanded the field
to 4 and 5 positions after the decimal - all are zeroes.

I just can't figure this out!

thanks
Sara

Jan 31 '07 #1
2 1027
sara wrote:
I have a text box on a form whose control source is

=IIf([txtPercentTotal]>1,"Total is Over 100%; Please
Adjust",IIf([txtPercentTotal]<1,"Total is UNDER 100%; Please
Adjust","Total is 100%"))

I have also tried
=IIf([txtPercentTotal]>1,"Total is Over 100%; Please
Adjust",IIf([txtPercentTotal]<1,"Total is UNDER 100%; Please
Adjust",IIf([txtPercentTotal]=1,"Total is 100%")))
and

=IIf([txtPercentTotal]=1,"Total is
100%",IIf([txtPercentTotal]>1,"Total is Over 100%; Please
Adjust",IIf([txtPercentTotal]<1,"Total is UNDER 100%; Please
Adjust")))

The problem is that I don't get the "Total is 100% message" and the
total is 100%. I can adjust one of the 14 figures and correctly get
the OVER and UNDER messages, but the Equals message won't work.

I've added the values in Excel. Each field is defined as double. I
typed in the values that are being added right into the table (and
they will eventually come from a form). I have expanded the field
to 4 and 5 positions after the decimal - all are zeroes.

I just can't figure this out!

thanks
Sara
Just guessing, maybe a conversion error? You know, decimal numbers are
stored in an imprecise hexidecimal manner. Adding them up sometimes
results in weird and unexpected results.

Maybe try doing a debug.print txtPercentTotal.value and see what you
actually have there. It might look like 1.00000000014124 or something
equally crazy.

--
Smartin
Your message was received. Your message was received. Your message was
received.
Feb 1 '07 #2
"sara" <sa*******@yahoo.comwrote in message
news:11**********************@m58g2000cwm.googlegr oups.com...

Just a hunch but try

=IIf(CInt([txtPercentTotal])>1,"Total is Over 100%; Please
Adjust",IIf(CInt([txtPercentTotal])<1,"Total is UNDER 100%; Please
Adjust","Total is 100%"))

You say how you're trying to do something but not *what* you're trying to
do. You never know, someone may have an existing or even better method of
achieving your goal.

Regards,
Keith.
www.keithwilby.com
Feb 1 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Oliver Spiesshofer | last post by:
Hi, I have a script that calls an fopen() on an external URL. I can run the script from the server as an url fine. When however the script should be run from crontab, it does not work. I get ...
5
by: Catherine | last post by:
I am having a problem viewing asp pages on iis version 5.1 xp pro. HTML pages are viewable on http://localhost but .asp pages are not. I have created a test program called timetest.asp with the...
19
by: Allen Thompson | last post by:
sorry for the simple question, haven't done this in a while. when I use the following script it keeps displaying the value of "x" like a string. for example, if I type the number 7 in the prompt,...
0
by: Sebastian Sosna | last post by:
Hi there! iam trying a code snippet from MSDN heres the link : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/netdir/netds/creating_groups.asp ive tried the code but it...
7
by: Christine | last post by:
My code has a split function that should split the text file of numbers. I've run this in previous programs as it is here and it worked, but now it wont work for some reason and returns...
1
by: Gary | last post by:
I have the following in my web.config.... <customErrors mode="RemoteOnly" defaultRedirect="Applicationerror.aspx"/> but, my error page does not display. Instead a 'Runtime Error' page...
14
by: squash | last post by:
The following code works fine in Firefox/Netscape but wont work in IE. I suspect the problem is with one of these two simple functions. If there is no obvious error Ill paste the entire code. ...
8
by: Mark12345 | last post by:
Hi folks, thanks for looking. I have a database that takes down order details. Each customer has there own priceid in the price table. the errors that I get say enter parameter value for:...
2
by: jcollins1991 | last post by:
im trying to make a program thats supposed to check whether 2 strings are anagrams of each other (anagram = same letters in both strings, but in different orders... "cool as wet art" , and "cs at...
2
by: Admiral | last post by:
Hi, Anyone knows how this works? I have made a textbox called Editbox1 and 10 buttons. b0, b1, b2 etc. What i want to do is when i press a button, b1 for example, a number 1 appears into...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.