Solved

How to keep the "Position>Set to Front" to stay in the from of the checkbox?

Posted on 2015-02-15
9
112 Views
Last Modified: 2016-02-11
PROBLEM
The set position to front is not staying in the from.

DESCRIPTION
I am text box with using conditional formatting  to cover checkboxes that are not checked. If the user clickes the textbox used to cover the checkbox, the position of the textbox goes to the back,
Please see attached
Format-Error.jpg
Set-Position.jpg
0
Comment
Question by:cssc1
[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
  • 4
  • 4
9 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 40611519
Try setting these textbox properties:

Locked -->  Yes
Enabled --> No
0
 
LVL 25

Expert Comment

by:chaau
ID: 40611579
I recommend that instead of using a textbox to cover the checkboxes you modify the .Visible property of the actual checkboxes and make them Visible/Invisible. If you just cover them they are still accessible and can be tabbed through (using the <Tab> key). When they are activated with the <Tab> key they can be checked/unchecked using the spacebar.
0
 

Author Comment

by:cssc1
ID: 40612576
The Text Box properties are already set to "Locked -->  Yes, Enabled --> No" .

The property adjustment for "Visible or NonVisible" is one or the other. How would I work this out for visible if another check box (in the same table and form) is checked YES, to make the second check box become visible?
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 25

Expert Comment

by:chaau
ID: 40613307
The easiest way to achieve this is to use the Event Procedure.
Open the form in the design view and select the checkbox that is supposed to control the visibility of the other checkboxes. Open its properties. Select the events tab. Click on the OnClick event and select the "Event Procedure". The VBA editor should come up. In the code type this:
Private Sub Check0_Click()
 [Check4].[Visible] = [Check0]
End Sub

Open in new window

This code assumes that the "master" checkbox is called Check0 and the "slave" checkbox is called Check4. You need to change the names of the controls in the code to match yours. If a check box controls visibility of more than one element add additional lines:
 [Check4].[Visible] = [Check0]
 [Check5].[Visible] = [Check0]
 [Check6].[Visible] = [Check0]

Open in new window

To make the controls behave in reverse use the Not operator:
 [Check4].[Visible] = Not [Check0]
 [Check5].[Visible] = Not [Check0]
 [Check6].[Visible] = Not [Check0]

Open in new window

0
 

Author Comment

by:cssc1
ID: 40614357
For some reason I am getting compile error. On the image attached I have what I tried.
Errors.jpg
0
 
LVL 25

Expert Comment

by:chaau
ID: 40615269
You need to use the proper name for your checkboxes. Open the Form in the design view, right click on a check box and select "Properties". In the properties view look for the "name" propertyName PropertyUse it as a name in the VBA code
0
 

Author Comment

by:cssc1
ID: 40616505
chaau,
   I created a small test db to test the code just as explained. I still can't get the code to work. The test db has one table with three fields, two are check boxes and one is an ID field. I named the exactly as in the example.

Can you please get this example working so I can learn how to do it on other forms?

thank you very much
TESTDB.accdb
0
 
LVL 25

Accepted Solution

by:
chaau earned 500 total points
ID: 40617672
Here you go. The checkboxes in your form are named as Ctl0 and Ctl4. These name are such because Access could not use the names of the table columns (0 and 4) as the control names. Please note, that it is not a good idea to name the columns the way you did. The names should be more specific, like "ProductCode", "ProductDescription", "IsActive", etc.

I have attached the database with the code. The code to control the visible/invisible state of the checkboxes is in Ctl4_Click subroutine. I have also added a Form event OnCurrent to initialise the visibility status of the checkboxes on skipping to the next/previous record.
Private Sub Ctl4_Click()
    Ctl0.Visible = Ctl4
End Sub

Private Sub Form_Current()
    Ctl4_Click
End Sub

Open in new window

The database is attached
TESTDB.accdb
0
 

Author Closing Comment

by:cssc1
ID: 40617945
Perfect, thanks for ther help
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

Some code to ensure data integrity when using macros within Excel. Also included code that helps secure your data within an Excel workbook.
Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
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…
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…

756 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