Option group & select case

geoffreyp

Registered User.
Local time
Today, 18:26
Joined
Nov 27, 2009
Messages
13
I have an option group on a form which gives choices about whether a persons contact details are available to be printed out(on a report). I need assistance with two areas.

  1. Do I need to store the value of the option group in a table for later use or can I simply access the value from the form? [forms] ! [fEntryDetails] ! [fConDetOpGp] The option group has values 1 to 7
  2. I’m not sure how to set up the select case expression to help deal with option group etc.

Here is what I have thus far;

Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)

Select Case (not sure what to put for this expression)

Case 1
???????
Me.address.Visible = True
Me.town.Visible = True
Me.Home_phone.Visible = True
Me.email.Visible = True

Case 2

Me.address.Visible = True
Me.town.Visible = True
Me.Home_phone.Visible = False
Me.email.Visible = False

Case 3

Me.address.Visible = True
Me.town.Visible = True
Me.Home_phone.Visible = True
Me.email.Visible = False

Case 4 etc

End Select

End Sub

Your assistance is greatly appreciated
 
Is your Option group bound to a control in your underlying table?

In any case try;
Code:
Private Sub GroupHeader1_Format(Cancel As Integer, FormatCount As Integer)

Select Case[COLOR="Purple"][B] YourOptionGroupName[/B][/COLOR]

Case 1
???????
Me.address.Visible = True
Me.town.Visible = True
Me.Home_phone.Visible = True
Me.email.Visible = True

Case 2

Me.address.Visible = True
Me.town.Visible = True
Me.Home_phone.Visible = False
Me.email.Visible = False

Case 3

Me.address.Visible = True
Me.town.Visible = True
Me.Home_phone.Visible = True
Me.email.Visible = False

Case 4 etc

End Select

End Sub
 
Thanks for your reply, yes the Option group is bound to a control in an underlying table.
 
In that case the code above should be all you need. Although I'd probably put the code in the Form's On Current event, and the On Click event of the Option Group.
 
Currently I have the event(although not operable) in the reports On Format event since that is where the details will show up. Is that correct? or do I go with your suggestion of placing the event in BOTH of the places you suggest?

thanks in anticipation
 
If you are interested in controling the display while viewing or printing you might also be interested in the DisplayWhen Property
 
Currently I have the event(although not operable) in the reports On Format event since that is where the details will show up. Is that correct? or do I go with your suggestion of placing the event in BOTH of the places you suggest?

thanks in anticipation
My bad :o I didn't notice we are dealing with a report.
 
Got it working. Placed the control name Me.ContactDetails for the expression for select case and hey presto, it functions as it should.
The DisplayWhen Property will hide/show all contents where as I only wanted to show SOME of the contents at appropriate times.
Thanks to all

Till next time... because there will be!
 

Users who are viewing this thread

Back
Top Bottom