Solved

Form option group

Posted on 2013-01-18
5
385 Views
Last Modified: 2013-01-18
Hi guys,

I have a form option group named opt_group1 including 2 check boxes named check1 and check2.
On a report I have 2 labels named label1 and label2.
I would like to have the label1 visible and label 2 non-visible when I check the check1, the label2 visible and label1 non-visible when I check the check2 and no label visible when no check box is checked.
Can anyone please tell me how to do this?
Thank you
0
Comment
Question by:marian68
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 335 total points
ID: 38793362
Your option group has values associated with each of those checkboxes, which determine the overall value of the option group.  Double-check those values, and adjust this code which should be placed in the Report's Detail Format event:


Private Sub Detail_Format()

If IsNull(Forms!YourFormName.opt_group1) then
  Me.Label1.Visible = False
  Me.Label2.Visible = False
Else
   Me.Label1.Visible = (Forms!YourFormName.opt_group1 = 1) 
   Me.Label2.Visible =  NOT (Forms!YourFormName.opt_group1 = 1) 
End IF

End Sub

Open in new window

0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 38793369
I assume that the option group is bound to a field in the table that is the RecordSource for your report.

If that is the case, then you should be able to use the Report detail sections Format or Print event to execute code similar to:

me.label1.Visible = (me.[BoundField] = 1)
me.label2.Visible = (me.[BoundField] = 2)

or something along those lines.  Try the format event first.
0
 

Author Closing Comment

by:marian68
ID: 38793541
It worked very well.
Thank you and have a nice day.
0
 
LVL 48

Expert Comment

by:Dale Fye
ID: 38793585
too slow, again!
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38793590
:-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question