473,468 Members | 1,887 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Need to make a checkbox in a form change the form

4 New Member
Let me reword the question - I have a checkbox ([Active]) in a form and I would like if the box was checked that the color of the form itself changes, how do I do that?
Jun 25 '14 #1
3 980
twinnyfo
3,653 Recognized Expert Moderator Specialist
whatsyourtheory,

It depends on what you want the form to do. To begin with, I would add some code to the OnCurrent Event of the form (assuming you have a check box called chkActive, which has the control source for the field "ISActive" on your Table):

Expand|Select|Wrap|Line Numbers
  1. If Me.chkActive Then
  2.     'Add code to do things to identify an active record
  3. Else
  4.     'Add code to do things to identify an inactive record
  5. End If
The rest is up to you to figure out how you want to highlight this.
Jun 25 '14 #2
whatsyourtheory
4 New Member
What I ended up doing was changing the conditional formatting on the title text so that when [Active]= False the background of the title text would be red. I also did this in some other forms, turning the email field inactive when [Active]= False. Since I don't understand the code at all, I pretty much mess around until something works - I wouldn't even begin to know where to put the code.
Jun 25 '14 #3
NeoPa
32,556 Recognized Expert Moderator MVP
Try this :
  1. Go to the design view of your form.
  2. Make sure the Properties are shown on the screen.
  3. Select the section whose colour you're interested in changing. I'll assume that it's the Detail section.
  4. Note the existing value of [Back Color] from the properties. We'll refer to it in future as {A}.
  5. Change the colour of this section to the alternate colour you wish to use when your CheckBox is set to True.
  6. Note the new value of [Back Color] from the properties. We'll refer to this in future as {B}.
  7. Update the [Tag] property to the following - remembering to replace {A} and {B} with the values you noted earlier :
    {A}|{B}
  8. Click on (to select) your CheckBox control.
  9. Find the Event property After Update and double-click the text. This will set the value to the text "[Event Procedure]".
  10. At the right of this property you should now see a button with an ellipsis (...). Click on that.
  11. Having been taken to where you can enter your code paste the following in (Making sure not to duplicate what's already there) :
    Expand|Select|Wrap|Line Numbers
    1. Private Sub Active_AfterUpdate()
    2.     With Me.Detail
    3.         .BackColor = CLng(Split(.Tag, "|")(IIf(Me.Active, 1, 0)))
    4.     End With
    5. End Sub
If you follow these instructions carefully you should have exactly what you need as well as a clue as to how to get to where you can enter code for a form ;-)

PS. I updated the post after I realised the name of the CheckBox had been included in a previous version of the question.
Jun 28 '14 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Werner Kaiser | last post by:
Hi, I want to change the text for the file-browse button within a form: I have something like that: <FORM ENCTYPE="multipart/form-data" ACTION="<?php echo basename(__FILE__)...
2
by: juglesh | last post by:
hi, all, thanks for reading. i have a form in which i want drop down boxes to dynamically change some hidden fields: http://cynthialoganjewelry.com/test4.htm <form name=test method="post" > ...
1
by: Simon Harvey | last post by:
Hi, When I make a small change to an aspx page, (but not the code behind), does the site need to be recompiled before the changes will be there? Thanks Simon
15
by: http://www.visual-basic-data-mining.net/forum | last post by:
Does anyone have any idea how to transferring data from TextBox1 in form1 to textBox2 in form2..... That means after i fill in any data in textBox1 and click Next button... It will bring me to...
21
by: Just Me | last post by:
I've tried in a few places using a variable name Form and it appears to be OK. For example: Public Shared Sub WritePositionsInRegistry(ByVal Form As Form, ByVal SubkeyName As String) Is it OK...
3
by: chrispy102 | last post by:
Hi all, I have an MDI app developed using vis studio 2005. The problem I have is that evey time I close a Child form and open another, the CPU PF Usage increments slighty. This happens every time...
7
by: Lenny5160 | last post by:
I have an Access 2003 form with 58 checkboxes. Each checkbox has 2 corresponding combo boxes, which I would like to keep hidden until their box has been checked. The naming is consistent, with the...
7
by: Thom Little | last post by:
I am using C # .NET Framework 3.5. I have a calling form that invokes dialog box (called form). I want a button in the called form to change the value of a property in a control in the calling...
4
by: John Biggs | last post by:
I'm running a 2.0 .NET app on my local machine; the app uses Global.asax to trigger logic at both Application and Session Start. Up until this week, session management in this application was...
1
by: samnine | last post by:
I have a Master form in windows application, developed in c#, visual studio 2008. Initially form name is "Management"(which is set through properties windows). Now based upon logged in user I...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.