473,386 Members | 1,962 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,386 software developers and data experts.

Percent Format in a Control

This is going to be a really stupid question, but I am having a problem
with the percent format in a control on a form.

My end goal is that I want the user to enter 17 and have the control
display 17% and hold the value of seventeen percent.

I have the control propertes set to the following:

Name: comflatpercent
Format: percent
Deciaml places: 2

When I try enter 17 or .17 the control displays 0%. How can I make this
work?

Thanks in advance!!

Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
3 6587
If the control is bound to a field in a table, make sure the field has a
floating point data type, like single, and make sure that the control is
formatted correctly. If you have the right data type and format and then
enter ".17", you should see 17%. However, if you want to enter "17" and then
see 17%, you need to have the form do the division by 100 for you, probably
in the control's AfterUpdate event:

Me![MyField] = Me![MyField]/100

"Nothing" <me@you.com> wrote in message
news:1102475343.b9be007a3c6a0e9712b7a44dcbd5cad4@t eranews...
This is going to be a really stupid question, but I am having a problem
with the percent format in a control on a form.

My end goal is that I want the user to enter 17 and have the control
display 17% and hold the value of seventeen percent.

I have the control propertes set to the following:

Name: comflatpercent
Format: percent
Deciaml places: 2

When I try enter 17 or .17 the control displays 0%. How can I make this
work?

Thanks in advance!!

Michael

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #2
Here is an implementation of Dave's idea.

1. Paste the function below into a standard module (Modules tab of Database
windows).

2. Set the After Update property of any text box you wish to apply this to.
For example, if you have a text box named Discount, set its After Update
property to:
=MakePercent([Discount])

The code divides by 100 only if the user did not type the % character.

Public Function MakePercent(txt As TextBox)
If Not IsNull(txt) Then
If InStr(txt.Text, "%") = 0 Then
txt = txt / 100
End If
End If
End Function
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Dave M" <NO************@DROPTHISisland.net> wrote in message
news:GKutd.437236$Pl.383955@pd7tw1no...
If the control is bound to a field in a table, make sure the field has a
floating point data type, like single, and make sure that the control is
formatted correctly. If you have the right data type and format and then
enter ".17", you should see 17%. However, if you want to enter "17" and
then
see 17%, you need to have the form do the division by 100 for you,
probably
in the control's AfterUpdate event:

Me![MyField] = Me![MyField]/100

"Nothing" <me@you.com> wrote in message
news:1102475343.b9be007a3c6a0e9712b7a44dcbd5cad4@t eranews...
This is going to be a really stupid question, but I am having a problem
with the percent format in a control on a form.

My end goal is that I want the user to enter 17 and have the control
display 17% and hold the value of seventeen percent.

I have the control propertes set to the following:

Name: comflatpercent
Format: percent
Deciaml places: 2

When I try enter 17 or .17 the control displays 0%. How can I make this
work?

Thanks in advance!!

Michael

Nov 13 '05 #3
Thanks guys. That did the trick.

Michael Charney

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4

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

Similar topics

4
by: MX1 | last post by:
Hi all, I've setup a table with one field that will hold percent values. The type is number and the format is percent on the field. When I do data entry directly into the field, I have to put...
1
by: Terencetrent | last post by:
I am trying to format a query expression drawn from a dialog box as percent. The original statement to get the value for the query is as follows: New%markup: !! The dialog box looks the...
0
by: Macbeth | last post by:
Thanks to All who Help, I am creating a crosstab querry to place in a report. All my data is correct and I do not seem to have any problem with this area. I am having problems with displaying...
1
by: Alan Lane | last post by:
Hello world: I'm having trouble finding how to escape the percent sign ("%") from a SQL query so that it will show up in an Access report. Here's my SQL string ... '--Build SQL String...
2
by: Peter Fuller | last post by:
does .net have a class that will put parenthesis around negative percent?
39
by: VidTheKid | last post by:
THE PROBLEM The % symbol is too vague when defining dimensions in CSS and HTML. It can relate to an inherited value, a measure of the containing element (which can differ between box models) or...
1
by: parthis | last post by:
Hi, I am new to Access and working a Report to display a Percentage value. The value in db is a text with value 23 But when i apply Format = Percent in design view of Reports it renders it...
3
by: Ulrich Eckhardt | last post by:
Hi! I'm still mostly learning Python and there is one thing that puzzles me about string formatting. Typical string formatting has these syntaxes: "%s is %s" % ("GNU", "not Unix") "%(1)s...
4
by: plaguna | last post by:
Every time I calculate numbers to get a percent format type in a query It gives me a big number. For instance: 7689.43% instead of 76.89%. I tried every possibility in the Property Sheet and It...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.