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

Radio Button

2
Hi,

I have a Radio Button with label "Status" in my form to choose between two options:
"Pending" or "Completed".

The problem is when I display the "Status" field in a report. It gives me either "Yes" if the status is pending or "No" if the status is completed. These values (Yes or No) don't make sense to the end user. I want to change the display to be either "Pending" or "Completed". How can I do this?

p.s. I have no background in Visual Basic.
Oct 27 '09 #1

✓ answered by Stewart Ross

Hi, and Welcome to Bytes!

It appears that your Status field is being represented as a Boolean value - one that is represented by True/False, Yes/No (internally stored as an integer value, -1 for True/Yes and 0 for False/No).

If this is so you can change the formatting of the textbox in your report and apply a custom format to display "Pending" or "Completed" instead of "Yes" and "No". Open your report in design view and select the Status text box. If the properties tabs are not open right-click and select Properties. Have a look at the Format property of the property tabs. It may say Yes/No at present. Change this to the following text:

;"Completed";"Pending"

The opening semicolon is deliberate and must be included.

What this does is to apply a custom format to a numeric value. In this case, there is no format for positive values (>0) - hence the lone semicolon at the start. The text "Completed" is in the second position - which is what to display if the value is negative (<0). The text "Pending" is in the third position - which is what to display if the value is 0. There is no need for a fourth choice in this instance - which would be what to display if the field is null.

Alternatively, if you cannot make this work, you can take a different approach by using a calculated field instead. To do this, select the existing textbox for your status field and change its name property to something not bound to one of the underlying fields in your query or table (e.g. txtStatusText). Change the ControlSource property from Status to

=IIF([Status] = 0, "Pending", "Completed")

Both approaches assume that status "Pending" is represented by 0 and "Completed" by -1. If this is not the case the custom format approach is unlikely to work, but the calculated field can easily be adapted by changing the value tested in the IIF statement.

Neither approach requires any VBA at all.

-Stewart

2 2559
Stewart Ross
2,545 Expert Mod 2GB
Hi, and Welcome to Bytes!

It appears that your Status field is being represented as a Boolean value - one that is represented by True/False, Yes/No (internally stored as an integer value, -1 for True/Yes and 0 for False/No).

If this is so you can change the formatting of the textbox in your report and apply a custom format to display "Pending" or "Completed" instead of "Yes" and "No". Open your report in design view and select the Status text box. If the properties tabs are not open right-click and select Properties. Have a look at the Format property of the property tabs. It may say Yes/No at present. Change this to the following text:

;"Completed";"Pending"

The opening semicolon is deliberate and must be included.

What this does is to apply a custom format to a numeric value. In this case, there is no format for positive values (>0) - hence the lone semicolon at the start. The text "Completed" is in the second position - which is what to display if the value is negative (<0). The text "Pending" is in the third position - which is what to display if the value is 0. There is no need for a fourth choice in this instance - which would be what to display if the field is null.

Alternatively, if you cannot make this work, you can take a different approach by using a calculated field instead. To do this, select the existing textbox for your status field and change its name property to something not bound to one of the underlying fields in your query or table (e.g. txtStatusText). Change the ControlSource property from Status to

=IIF([Status] = 0, "Pending", "Completed")

Both approaches assume that status "Pending" is represented by 0 and "Completed" by -1. If this is not the case the custom format approach is unlikely to work, but the calculated field can easily be adapted by changing the value tested in the IIF statement.

Neither approach requires any VBA at all.

-Stewart
Oct 27 '09 #2
memi
2
Hi,

The IIF condition worked and everything looks better now.

Thanks a lot :)
Oct 27 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
5
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
3
by: John Davis | last post by:
I created a ASP.NET Web Form using VB.NET with a text box, 2 radio buttons. When the user click the first radio button, the text will change to uppercase. If the user clicks the other radio button,...
3
by: Amelyan | last post by:
When we want radio button to belong to a group name we say, radio1.GroupName="GroupA". In this case, radio1 will be unselected if another radio button is selected in "GroupA". Is there a way...
8
by: David Cameron | last post by:
I noticed that using an HTMLInputRadioButton and specifying a value to be an empty string (""), this is overridden by ASP.Net which set the value of the control to be the same as the ID of the...
1
by: Joe Attardi | last post by:
Hi all, On a form on one of my pages I have two <select> elements, and each one is paired up with a radio button. The idea is to choose an item from one list or the other and select the radio...
9
by: IchBin | last post by:
I can not see what the problem is with this script. I am just trying to set a radio button by calling setCheckedValue('abbr_letter', 'V'). Sorry I am new to javascript. <html> <head> <script...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
0
by: jehugaleahsa | last post by:
Hello: I have radio buttons bound to boolean properties in a business object. private void bindRadioButton(RadioButton button, string propertyName) { Binding binding =...
8
by: photoboy | last post by:
I have racked by brain long enough on this, so now I need the help of someone who knows what they are doing. Here is what I am trying to achieve: First, I have two radio buttons (both unchecked)...
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
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
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.