From: blake7 on
Hi All, I have a form with an option group on it, it has 4 values which it is
storing in a table, I would like to make a text box disappear when one of the
radio buttons is selected, I have tried the code below in the After_update of
the form but it does not work, what is wrong? Thanks.


If Me.Option66 = True Then
Me.Text59.Visible = False
Else
Me.Text59.Visible = True
End If
From: Dirk Goldgar on
"blake7" <blake7(a)discussions.microsoft.com> wrote in message
news:DA24E229-5199-4D70-B9C6-B1E16A3FD2B7(a)microsoft.com...
> Hi All, I have a form with an option group on it, it has 4 values which it
> is
> storing in a table, I would like to make a text box disappear when one of
> the
> radio buttons is selected, I have tried the code below in the After_update
> of
> the form but it does not work, what is wrong? Thanks.
>
>
> If Me.Option66 = True Then
> Me.Text59.Visible = False
> Else
> Me.Text59.Visible = True
> End If


Is Option66 the name of the option frame or of the option button in the
frame? You need to check the value of the option frame control, and compare
it to the Option Value of the option button. As you add option buttons --
or other option controls -- to an option frame, each button is assigned its
own Option Value, which will be the value of the option frame when that
button is selected.

--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

From: blake7 on
Hi Dirk, yes option66 is the name of the option button and not the frame, how
should my code look? thanks for answering

"Dirk Goldgar" wrote:

> "blake7" <blake7(a)discussions.microsoft.com> wrote in message
> news:DA24E229-5199-4D70-B9C6-B1E16A3FD2B7(a)microsoft.com...
> > Hi All, I have a form with an option group on it, it has 4 values which it
> > is
> > storing in a table, I would like to make a text box disappear when one of
> > the
> > radio buttons is selected, I have tried the code below in the After_update
> > of
> > the form but it does not work, what is wrong? Thanks.
> >
> >
> > If Me.Option66 = True Then
> > Me.Text59.Visible = False
> > Else
> > Me.Text59.Visible = True
> > End If
>
>
> Is Option66 the name of the option frame or of the option button in the
> frame? You need to check the value of the option frame control, and compare
> it to the Option Value of the option button. As you add option buttons --
> or other option controls -- to an option frame, each button is assigned its
> own Option Value, which will be the value of the option frame when that
> button is selected.
>
> --
> Dirk Goldgar, MS Access MVP
> Access tips: www.datagnostics.com/tips.html
>
> (please reply to the newsgroup)
>
From: blake7 on
Hi Dirk, tried this below but no luck, the default value of the frame63 is 3,
the stored value of option66 is 1

Private Sub Form_AfterUpdate()
If Me.Frame63.Value = 1 Then
Me.Text59.Visible = False
Else
Me.Text59.Visible = True
End If
End Sub

"blake7" wrote:

> Hi Dirk, yes option66 is the name of the option button and not the frame, how
> should my code look? thanks for answering
>
> "Dirk Goldgar" wrote:
>
> > "blake7" <blake7(a)discussions.microsoft.com> wrote in message
> > news:DA24E229-5199-4D70-B9C6-B1E16A3FD2B7(a)microsoft.com...
> > > Hi All, I have a form with an option group on it, it has 4 values which it
> > > is
> > > storing in a table, I would like to make a text box disappear when one of
> > > the
> > > radio buttons is selected, I have tried the code below in the After_update
> > > of
> > > the form but it does not work, what is wrong? Thanks.
> > >
> > >
> > > If Me.Option66 = True Then
> > > Me.Text59.Visible = False
> > > Else
> > > Me.Text59.Visible = True
> > > End If
> >
> >
> > Is Option66 the name of the option frame or of the option button in the
> > frame? You need to check the value of the option frame control, and compare
> > it to the Option Value of the option button. As you add option buttons --
> > or other option controls -- to an option frame, each button is assigned its
> > own Option Value, which will be the value of the option frame when that
> > button is selected.
> >
> > --
> > Dirk Goldgar, MS Access MVP
> > Access tips: www.datagnostics.com/tips.html
> >
> > (please reply to the newsgroup)
> >
From: Dirk Goldgar on
"blake7" <blake7(a)discussions.microsoft.com> wrote in message
news:6E60B8E0-DD67-4F03-8BAF-810E68DEA031(a)microsoft.com...
> Hi Dirk, tried this below but no luck, the default value of the frame63 is
> 3,
> the stored value of option66 is 1
>
> Private Sub Form_AfterUpdate()
> If Me.Frame63.Value = 1 Then
> Me.Text59.Visible = False
> Else
> Me.Text59.Visible = True
> End If
> End Sub


It would help if you said exactly what you mean by "no luck". Do you get an
error message? Does nothing at all happen, or does something happen that
shouldn't?

On the off chance that you are just using the wrong event for this, it seems
to me that I might use the form's Current event and the option frame's
AfterUpdate event for this. I would probably code those like this:

'------ start of code ------
Private Sub Form_Current()

Me.Text59.Visible = (Nz(Me.Frame63, 0) <> 1)

End Sub

Private Sub Frame63_AfterUpdate()

Me.Text59.Visible = (Nz(Me.Frame63, 0) <> 1)

End Sub
'------ end of code ------






--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)