Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Form option group

Posted on 2013-01-18
5
Medium Priority
?
386 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 1340 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

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

688 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