Solved

Form option group

Posted on 2013-01-18
5
378 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

708 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

18 Experts available now in Live!

Get 1:1 Help Now