Solved

Check box Visible

Posted on 2014-01-17
7
253 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

863 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

22 Experts available now in Live!

Get 1:1 Help Now