Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option group values as text? 3

Status
Not open for further replies.

spencern

Programmer
Dec 20, 2001
78
US
Hello,
I'm sure this must be simple but I can't get the values of radio buttons in an option group to have values stored as text, I can only get 1 or 2 for a yes/no situation. Can I store Yes or No in the table instead of 1 or 2?

Thanks,
Spencer
 
Okay, obviously the field in your database is defined as boolean (ie: Yes/No), and your option buttons' values are bound to that boolean field.

Here's the good news. It doesn't matter what's really stored there, you have control of its appearance.

Go to the table in design mode and click on the boolean field.

In the Lookup tab in the Field Properties section of the screen, make sure the display control is set to "Text Box"

Click on the General Tab and set the Format property to Yes/No.

Save the table. Now when you open the table it'll show Yes and No values.

When doing any code for this boolean field you can refer to the field's value as True or False, Yes or No, On or Off, or 0 and -1.

 
If MyField = 1
Then MyField = "Yes"
Else
MyField = "No"
End If

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
ASP design tips, demo database on the Web, free barchart tool...
 
I tried your code BullSchmidt and it works fine IF the field is text type instead of boolean. I had assumed he had a boolean field due to the use of option buttons.

I had not thought of using option buttons to assign text values in the table. I'd normally use a combo or list box, but if there are only 2 or 3 choices, option buttons might "feel" and look better. I'll have to remember that. Thanks!
 
Thanks ReluctantDataGuy and your answer rocked too!

Sometimes we just do our best to guess at what somebody REALLY wants and it's just "hit or miss" but sometimes a little fun to TRY to play detective too (I'm sure you probably agree)...

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
ASP design tips, demo database on the Web, free barchart tool...
 
What if you have more than two options. I have a frame with 8 choices. Some of the choices, when chosen, open up another set of options. I have a total of about 40 options altogether. Like Spencern, instead of seeing numbers (option values) I would rather see the caption for that option choice. Is that possible? I am new at coding so please be specific with any advice you can give. Thanks, Janet Lyn
 
Thanks ReluctantDataGuy and Bullschmidt, I actually can use both of your answers. I have a few fields that are Boolean and then also some like gender where a yes/no doesn't exactly work :) Sorry I didn't mention it in my first post...

Thanks again,
Spencer
 
<<
What if you have more than two options. I have a frame with 8 choices. Some of the choices, when chosen, open up another set of options.
>>

Data driven combo box with two FORMs example by Adrian Forbes
Reloads the same page. Has PopulateListBox and RefreshPage subs.
Has demo to test. The demo takes awhile to refresh the page and doesn't put user back where was.
And here is another similar one by same author:
Two combos, one textbox example by Adrian Forbes

Universal Related Popup Menus v 2.02
Initially sends all data to the page and then lets JavaScript populate the second list box.
Has demo.


Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
ASP design tips, demo database on the Web, free barchart tool...
 
I'm still having some problems with my gender field. If I put an option group with radio buttons then it puts 1 or 2 into the table. If I use the If gender=1 then gender=male code from Bullschmidt in the after update of the option group then I get errors when selecting either of the buttons.

Could you tell me where I should be putting that code? I tried the afterupdate but it gives an error saying that it can't be a zero length string.

Thanks for your help,
Spencer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top