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

x
?
Solved

turn on Lable visible property for criteria

Posted on 2011-03-05
7
Medium Priority
?
460 Views
Last Modified: 2012-05-11
Experts, I have a form with a subform linked by LetterOfCreditID;ProjectID.
I have a lblExpired that I want to appear for when me.expiredYN = Yes but the lbl is only suppose to turn on for that particular record and not the others.   For example, there are 5 records on the subform and 2 of them are [ExpiredYN] = Yes then turn on the lblExpired for only those two records.  
With the code I have now, the lblExpired stays on for all the records when  [expiredYN] = Yes
How can I make the lblExpired turn on for when [ExpiredYN] = Yes but for only those records?  (ExpiredYN  is a true YN field. with name cboExpired)  lblExpired has its visible property = False

Private Sub Form_Current()

   If Me.ExpiredYN = 1 Then
            Me.lblExpired.Visible = True
    End If

thank you
0
Comment
Question by:pdvsa
[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
  • 3
  • 3
7 Comments
 
LVL 3

Expert Comment

by:DockieBoy
ID: 35044714
Hi there :)

Couple of questions.  

Is the subform a continuos form? (I'm guessing that is is, just want to be sure)
Is the label bound or unbound?
0
 
LVL 3

Expert Comment

by:JAMcDo
ID: 35044846
What version of MS Access are you using?

Versions 2007 and 2010 have conditional formatting for some controls (text boxes and combo boxes for instance) that you may find useful.

Conditional formatting for a form in design mode is found 'Form Design Tools' > 'Format'

J.

0
 

Author Comment

by:pdvsa
ID: 35044945
Dockieboy:  yes, it is continous.  the lable is unbound.

JAMCO:  not certain if you can turn on the visible property through conditional formatting.
0
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!

 
LVL 3

Accepted Solution

by:
DockieBoy earned 2000 total points
ID: 35045073
Ok, so what is happening is that on your form, when you use VBA to set the visibility property , Me.Control.Visible = True, it will replicate the same property for each record displayed.

I only use access 2003, so if this differs in other versions, anyone feel free to correct me.

Your right, you can't set the visibility property of a control with the standard conditional formatting (right click, conditional formatting), you may be able to do it using VBA, however, back to the original problem that it will display the same on each record.

There is also no conditional formatting for labels, so, work around.

Change the label to a text box.
Set the Enabled property to no, Locked property to yes, back style to transparent, Default value to "Insert Your Text Here"
Right click the control in design view, select conditional formatting.

Set Condition one to Expression is
Set the expression to ([MyCheckBoxName] = 0)
Set the text colour to match the detail colour of your form
make sure the enabled button is off (little button at the right hand side)

That should give you the effect you are looking for  :)

0
 

Author Comment

by:pdvsa
ID: 35048133
Oh yes... The text box trick.  I remember this now. I think i should be fine with your idea now.

Thank you
0
 

Author Comment

by:pdvsa
ID: 35048515
that worked great!  thanks...
0
 
LVL 3

Expert Comment

by:DockieBoy
ID: 35061205
Welcome
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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…

715 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