General information
Category:
Forms & Form designer
Title:
Optiongroup.Controlsource = a logical field
Not supposed to do that, since the value is numeric. But I want the effect of that. Consider a table of people with a logical sex field, where .T. is considered female and .F. male. To FoxPro, such a field means "female, true or false." But imagine a form with a check box and a caption "Female?" Looks pretty dumb. The appropriate control is an option group with one button labeled "male" and the other "female."
I left the optiongroup.ControlSource blank, then set Option2.ControlSource = mytable.female and Option1.ControlSource = !mytable.female. That almost worked. When I navigated the table with my form, the option buttons updated correctly. But when I tried to edit a record, the buttons wouldn't switch. When I edited a female record and clicked the male option button, the female button turned off but the male button didn't turn on. Then it didn't save the change.
I know I can use code in the OptionGroup.Click and the Form.Refresh to update the controlsource, but I like controlsources. Can it be done?
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only