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
Solved

Check box Visible

Posted on 2014-01-17
7
255 Views
Last Modified: 2014-01-17
I have code for an "On Current" event of a form. It is working if the value = 1... it doesnt' know what to do if the value isn't. If the value isn't 1, I need the Me.chkBooked to be invisible. Any ideas?

Thanks!
0
Comment
Question by:cansevin
  • 3
  • 2
  • 2
7 Comments
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39788641
Try something like this:
Me.chkBooked.Visible = (YourValue =1)

Open in new window

0
 

Author Comment

by:cansevin
ID: 39788654
I forgot... the code I am using is below. I need to make it "invisible" if the value is not 1

Private Sub Form_Current()

Me.chkBooked.Visible = Me.Frame109.Value = 1

End Sub
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39788711
Judging by the name, you must be using an Option Group.  You need to also put your code in the AfterUpdate event of your Frame control.

Private Sub Frame109_AfterUpdate()
    Me.chkBooked.Visible = (Me.Frame109.Value = 1)
End Sub

Open in new window


In your OnCurrent event you could use the same code or better still just call the the other procedure, that way there's only one section that needs to be maintained rather than two.

Private Sub Form_Current()
    Call Frame109_AfterUpdate
End Sub

Open in new window


As an aside, I would rename Frame109 to something more appropriate.  Something like:
fraBookingSelection or grpBookingSelection maybe.
0
Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

 

Author Comment

by:cansevin
ID: 39788749
Thanks for your help... Much appreciated. I added the "Call" to the Add current.

It is working when the value is 1. It just doesn't know what to do when the value is not 1 (which is to be invisible)

Is there an "Else" code to state that it should be invisible when the value is not 1?
0
 
LVL 29

Expert Comment

by:IrogSinta
ID: 39788761
No it should work as this is written. There must be something else going on. Maybe you can upload a copy with just that form?
0
 
LVL 74

Accepted Solution

by:
Jeffrey Coachman earned 500 total points
ID: 39788793
FWIW,

I generally avoid the syntax you are using because it does not explain what is happening.

I prefer code like these:

If Me.Frame109.Value = 1 Then
    Me.chkBooked.Visible=True
Else
    Me.chkBooked.Visible=False
End if

Or perhaps this:

If Me.Frame109.Value = 1 Then
    Me.chkBooked.Visible=False
Else
    Me.chkBooked.Visible=True
End if

...depending on your exact needs.
;-)

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39789995
glad I could help...
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
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 …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

861 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