Solved

Check box Visible

Posted on 2014-01-17
7
249 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
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
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.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

707 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

13 Experts available now in Live!

Get 1:1 Help Now