Solved

Form option group

Posted on 2013-01-18
5
380 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
  • 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 47

Expert Comment

by:Dale Fye (Access MVP)
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 47

Expert Comment

by:Dale Fye (Access MVP)
ID: 38793585
too slow, again!
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38793590
:-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…

930 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now