radio buttons grayed out....

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

HI, I created an option group with radio buttons on a form to input data. I
then pasted in some "After Update (Case ?, After Update, Event Procedure)
code" by piping the numeric case to an intermediate txt box not shown. This
stored the txt in the desirec field rather then a numeric value. My only
problem is that after I did this my radio button's stoped working. So, even
though it works the user will have no feedback that he actually did store the
right option. Any help on getting my radio buttons working so that I can
input a slew of data and learn something would be greatley appreciated.
 
Are you saying that your radio buttons/option group isn't connected to any
fields?

If you worked out the code to load the hidden text box from the option group
choice, couldn't you also add code that reads that hidden textbox and sets
the option group?

Would it be any simpler if you just stored the option group button value
instead of the circuitous
write-to-hidden-text-store-to-underlying-text-field process?

In fact, storing the option group value (1, 2, 3...) instead of a longer,
character based string would seem to be not only easier but take less room.
What was the reasoning that led to storing text instead?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
I want to store the information via a form rather then inputing it into a
table. That way I can be assured there is not typo's down the line.
Currentley I am using the below code pasted at the bottom but I think all
"IF" statements are being ignored. txtValues is the intermediate invisable
txt box that pipes the values to the field associated with the option group.
____________________________________________________________
Private Sub Frame37_AfterUpdate()
Select Case [Frame37]
Case 1
Me![txtValues] = "Meters"
Case 2
Me![txtValues] = "Feet"
Case 3
Me![txtValues] = "Fathoms"
Case 4
Me![txtValues] = "Feet / Fathoms"
Case 5
Me![txtValues] = "Feet / Meters"

If Frame37 = 1 Then
Me.Option40.Enabled = True
Me.Option42.Enabled = False
Me.Option44.Enabled = False
Me.Option46.Enabled = False
Me.Option48.Enabled = False
ElseIf Frame37 = 2 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = True
Me.Option44.Enabled = False
Me.Option46.Enabled = False
Me.Option48.Enabled = False
ElseIf Frame37 = 3 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = False
Me.Option44.Enabled = True
Me.Option46.Enabled = False
Me.Option48.Enabled = False
ElseIf Frame37 = 4 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = False
Me.Option44.Enabled = False
Me.Option46.Enabled = True
Me.Option48.Enabled = False
ElseIf Frame37 = 5 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = False
Me.Option44.Enabled = False
Me.Option46.Enabled = False
Me.Option48.Enabled = True
Else
Me.Option40.Enabled = True
Me.Option42.Enabled = True
Me.Option44.Enabled = True
Me.Option46.Enabled = True
Me.Option48.Enabled = True
End If
End Select
End Sub
 
Your If statements are ignored because you have them under Case 5 of your case
statement. If you ensure that your statements are properly indented you will
find it much easier to spot such problems.

You could in any case make your code much simpler if you renamed your option
controls as Option1 - Option5:

Private Sub Frame37_AfterUpdate()
Select Case [Frame37]
Case 1
Me![txtValues] = "Meters"
Case 2
Me![txtValues] = "Feet"
Case 3
Me![txtValues] = "Fathoms"
Case 4
Me![txtValues] = "Feet / Fathoms"
Case 5
Me![txtValues] = "Feet / Meters"
End Select
Option1.Enabled = False
Option2.Enabled = False
Option3.Enabled = False
Option4.Enabled = False
Option5.Enabled = False
Me("Option" & Frame37).Enabled = True
End Sub

HTH
John
##################################
Don't Print - Save trees

Jediah said:
I want to store the information via a form rather then inputing it into a
table. That way I can be assured there is not typo's down the line.
Currentley I am using the below code pasted at the bottom but I think all
"IF" statements are being ignored. txtValues is the intermediate invisable
txt box that pipes the values to the field associated with the option group.
____________________________________________________________
Private Sub Frame37_AfterUpdate()
Select Case [Frame37]
Case 1
Me![txtValues] = "Meters"
Case 2
Me![txtValues] = "Feet"
Case 3
Me![txtValues] = "Fathoms"
Case 4
Me![txtValues] = "Feet / Fathoms"
Case 5
Me![txtValues] = "Feet / Meters"

If Frame37 = 1 Then
Me.Option40.Enabled = True
Me.Option42.Enabled = False
Me.Option44.Enabled = False
Me.Option46.Enabled = False
Me.Option48.Enabled = False
ElseIf Frame37 = 2 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = True
Me.Option44.Enabled = False
Me.Option46.Enabled = False
Me.Option48.Enabled = False
ElseIf Frame37 = 3 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = False
Me.Option44.Enabled = True
Me.Option46.Enabled = False
Me.Option48.Enabled = False
ElseIf Frame37 = 4 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = False
Me.Option44.Enabled = False
Me.Option46.Enabled = True
Me.Option48.Enabled = False
ElseIf Frame37 = 5 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = False
Me.Option44.Enabled = False
Me.Option46.Enabled = False
Me.Option48.Enabled = True
Else
Me.Option40.Enabled = True
Me.Option42.Enabled = True
Me.Option44.Enabled = True
Me.Option46.Enabled = True
Me.Option48.Enabled = True
End If
End Select
End Sub

Jeff Boyce said:
Are you saying that your radio buttons/option group isn't connected to any
fields?

If you worked out the code to load the hidden text box from the option group
choice, couldn't you also add code that reads that hidden textbox and sets
the option group?

Would it be any simpler if you just stored the option group button value
instead of the circuitous
write-to-hidden-text-store-to-underlying-text-field process?

In fact, storing the option group value (1, 2, 3...) instead of a longer,
character based string would seem to be not only easier but take less room.
What was the reasoning that led to storing text instead?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
So, I renamed my option controls as Option1 - Option5 as requested, paste in
your code but get this error message.

'Run-time error '2101':
The setting you entered isn't valid for this property.'

What does this mean and how can I get aroud it. I noticed that when I click
'Debug' it highlights Option2.Enabled = False.

Any Ideas?


John Smith said:
Your If statements are ignored because you have them under Case 5 of your case
statement. If you ensure that your statements are properly indented you will
find it much easier to spot such problems.

You could in any case make your code much simpler if you renamed your option
controls as Option1 - Option5:

Private Sub Frame37_AfterUpdate()
Select Case [Frame37]
Case 1
Me![txtValues] = "Meters"
Case 2
Me![txtValues] = "Feet"
Case 3
Me![txtValues] = "Fathoms"
Case 4
Me![txtValues] = "Feet / Fathoms"
Case 5
Me![txtValues] = "Feet / Meters"
End Select
Option1.Enabled = False
Option2.Enabled = False
Option3.Enabled = False
Option4.Enabled = False
Option5.Enabled = False
Me("Option" & Frame37).Enabled = True
End Sub

HTH
John
##################################
Don't Print - Save trees

Jediah said:
I want to store the information via a form rather then inputing it into a
table. That way I can be assured there is not typo's down the line.
Currentley I am using the below code pasted at the bottom but I think all
"IF" statements are being ignored. txtValues is the intermediate invisable
txt box that pipes the values to the field associated with the option group.
____________________________________________________________
Private Sub Frame37_AfterUpdate()
Select Case [Frame37]
Case 1
Me![txtValues] = "Meters"
Case 2
Me![txtValues] = "Feet"
Case 3
Me![txtValues] = "Fathoms"
Case 4
Me![txtValues] = "Feet / Fathoms"
Case 5
Me![txtValues] = "Feet / Meters"

If Frame37 = 1 Then
Me.Option40.Enabled = True
Me.Option42.Enabled = False
Me.Option44.Enabled = False
Me.Option46.Enabled = False
Me.Option48.Enabled = False
ElseIf Frame37 = 2 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = True
Me.Option44.Enabled = False
Me.Option46.Enabled = False
Me.Option48.Enabled = False
ElseIf Frame37 = 3 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = False
Me.Option44.Enabled = True
Me.Option46.Enabled = False
Me.Option48.Enabled = False
ElseIf Frame37 = 4 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = False
Me.Option44.Enabled = False
Me.Option46.Enabled = True
Me.Option48.Enabled = False
ElseIf Frame37 = 5 Then
Me.Option40.Enabled = False
Me.Option42.Enabled = False
Me.Option44.Enabled = False
Me.Option46.Enabled = False
Me.Option48.Enabled = True
Else
Me.Option40.Enabled = True
Me.Option42.Enabled = True
Me.Option44.Enabled = True
Me.Option46.Enabled = True
Me.Option48.Enabled = True
End If
End Select
End Sub

Jeff Boyce said:
Are you saying that your radio buttons/option group isn't connected to any
fields?

If you worked out the code to load the hidden text box from the option group
choice, couldn't you also add code that reads that hidden textbox and sets
the option group?

Would it be any simpler if you just stored the option group button value
instead of the circuitous
write-to-hidden-text-store-to-underlying-text-field process?

In fact, storing the option group value (1, 2, 3...) instead of a longer,
character based string would seem to be not only easier but take less room.
What was the reasoning that led to storing text instead?

Regards

Jeff Boyce
Microsoft Office/Access MVP

HI, I created an option group with radio buttons on a form to input data.
I
then pasted in some "After Update (Case ?, After Update, Event Procedure)
code" by piping the numeric case to an intermediate txt box not shown.
This
stored the txt in the desirec field rather then a numeric value. My only
problem is that after I did this my radio button's stoped working. So,
even
though it works the user will have no feedback that he actually did store
the
right option. Any help on getting my radio buttons working so that I can
input a slew of data and learn something would be greatley appreciated.
 
Using a form for data entry/edit is absolutely correct ... you do NOT want
the user mucking about directly in the table.

My suggestion of storing the option group value (i.e., 1, 2, ...) in the
table would only be via the form, so when the user pulled up an existing
record (on the form), the option group would read, say, a 2, and "click" the
appropriate option group radio button on the form.

No need for the extra hidden text field, for translating from option group
values to text, or translating back again.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
Back
Top