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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Option Group Visible Property

Status
Not open for further replies.

shelby55

Technical User
Jun 27, 2003
1,229
CA
Hi

I am using Access 2003.

I have a bound option group called frmInjuryDegree where the user selects an option. If the option is "Severe" (which is value 5 for that group) then I want another option group frmSevereResult to be visible allowing to be selected.

I originally added code to the on load event of the form that allowed the option group to be invisible but if I edited the option group to severe to test and had the frmsevereresult be visible, it wouldn't disappear again if I edited the response to something other than severe.

Thanks.
 
shelby55 . . .

In your code you simply didn'nt take care of the alternate condition:
Code:
[blue]   If frmInjuryDegree = 5 Then
      frmSevereResult.Visible = true
   Else
      frmSevereResult.Visible = false
   End If[/blue]
[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hey

Duh...how stupid am I...thanks so much!
 
Hi Ace

Sorry but it's not working upon entry of the form. For instance, if I have a record that I'm looking at to edit or just viewing it, then these fields are still visible. This is probably because it's only effective on the after update event of the fields that need values. What event will I put it in to ensure the fields are never visible unless frmInjuryDegree is 5?

Thanks.
 
Hi

Sorry but it seems that all is fine until I change one record to show the frmInjuryDegree to 5 and then the fields show for all other records. So what am I doing wrong? Thanks.
 
shelby55 . . .

You need to explain exactly what it is you want to happen. I could be wrong, but it also looks like you'll need conditional formatting which can't be done with an option group.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Hi AceMan

The form is to collect data for a database so there are many records and the user can add new records.

What I want is for the field of frmSevereResult to only be visible when someone enters frmInjuryDegree = 5. So even when I go back into that record, if it's not frmInjuryDegree = 5 then it should still not be visible.

What's happening when testing is that if the frmInjuryDegree = 5 then for all subsequent records the field of frmSevereResult is now visible. Hope that explains it?
 

You might try putting your code in the OnCurrent event.


Randy
 
shelby55 said:
[blue] ... if the frmInjuryDegree = 5 then for all subsequent records the field of frmSevereResult is now visible.[/blue]
[ol][li]As I thought ... you need conditional formatting, however it can't be used on an Option Group.[/li]
[li]You can't [blue]hide[/blue] a control with conditional formatting. You can only [blue]disable[/blue] it (that disabled look).[/li][/ol]
Whish I had better news.

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see faq219-2884 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
CmdCloseForm.Visible = True
CmdCloseForm.Visible = false

use if to pick condition that it is wisible

Never give up never give in.

There are no short cuts to anything worth doing :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top