473,406 Members | 2,769 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Check box enabling other fields in a form

I have a form that I'm working on that I would like to be able to use a check box to enable other selections in the form. Otherwise I would like to have them as non selectable.

I have a checkbox called work order and I am using a lookup table called work order number and a date field. The checkbox will enable both of these.

Thanks for any help
Jun 18 '07 #1
14 10227
JKing
1,206 Expert 1GB
I recommend setting the Enabled property of the two controls to no in design view so when the form first opens the user is forced to click the check box to enable the controls.

The code to switch enabled property back and forth should be done in the click event of the check box.

Expand|Select|Wrap|Line Numbers
  1. Private Sub chkCheckBox_Click()
  2. If chkCheckBox = True Then
  3. Control1.Enabled = True
  4. Control2.Enabled = True
  5. Else
  6. Control1.Enabled = False
  7. Control2.Enabled = False
  8. End If
  9. End Sub
  10.  
Control1 and Control2 being the items you want to enabled or disable and chkCheckBox would be your check box name.

JKing
Jun 18 '07 #2
Great, I will try it out

Thanks again!
Jun 18 '07 #3
Unfortunately that isn't working, neither is enabling. Any ideas? Everything is entered in right. I even recreated it in a seperate form.
Jun 18 '07 #4
JKing
1,206 Expert 1GB
What are the two controls you're trying to enable?

And could you post me a snippet as well.
Jun 18 '07 #5
One is a number field (WorkOrderNumber) and the other is a drop down box (WorkOrder). Oh and the Checkbox is (CkeckBox)
Jun 18 '07 #6
Expand|Select|Wrap|Line Numbers
  1. Private Sub Checkbox_Click( )
  2. If Checkbox = True Then
  3. WorkOrderNumber.Enabled = True
  4. WorkOrder.Enabled = True
  5. Else
  6. WorkOrderNumber.Enabled = False
  7. WorkOrder.Enabled = False
  8. End If
  9. End Sub
Jun 18 '07 #7
JKing
1,206 Expert 1GB
So when you run the form and click the check box nothing at all happens? And when you uncheck the box nothing happens either?
Jun 18 '07 #8
Yes that's correct, and as I've said I re-created it in another form to try it out
Jun 18 '07 #9
Scratch that, I got it to work! I appreciate your assistance. All your code was right I had one thing I screwed up on in Access 2007. Sorry
Jun 18 '07 #10
JKing
1,206 Expert 1GB
Great to hear! I was really stumped for a moment trying to figure out what was wrong. Glad it's working though.
Jun 18 '07 #11
Now do you know anything about subforms? Cause now that I go to use this it enables it on every record in the subform and when I go to enter data in it gets recorded on every record I have! HELP!
Jun 18 '07 #12
Oh by the way this is a continuous subform
Jun 18 '07 #13
JKing
1,206 Expert 1GB
Not too sure about this one. Might want to try posting that question as another thread.
Jun 18 '07 #14
MMcCarthy
14,534 Expert Mod 8TB
Oh by the way this is a continuous subform
This is known as conditional formatting. You can't do this using code on a continuous form. Open the form in form view and set focus on the control you want to enable. Now go to the Format menu and select Conditional formatting. This should enable you to set the control to enabled on your conditions.
Jun 19 '07 #15

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

Similar topics

1
by: ratlhead | last post by:
Hey all, I've provided a form for a client of the company I work for that basically emails the form data to an email address. Only a couple of the many fields are required...nothing too fancy....
3
by: Jack | last post by:
Hi, I have a form when loaded, retrieves record from an access table. Among other fields there is a check box called FinalUpdate. This is tied to a field in Access of type Yes/No. The form...
3
by: Rich | last post by:
I have a form with 2 check boxes. One of the check boxes is used to specify that the user is a "primary contact." When I check the primary contact box I want a second box for "standard contact"...
5
by: Steve Wylie | last post by:
I am constructing an HTML questionnaire and one of the questions requires people to rate some choices from 1 to 5, where 1 is their favourite and 5 is their least favourite: Car Bus Taxi cab...
8
by: pw | last post by:
Hi, I need to create a function in javascript to check or uncheck all checkboxes in a form. From what I understand, I can do this either by specifying the name of the check box fields such as: ...
2
by: Chris Windsor | last post by:
I hope the following describe what I'm trying to do: I have created a tool to be used by product analysts when studying different cell phone designs. Part of the tool is a set of 11 forms on a...
3
by: Bryan Capps | last post by:
I have a text box control on a form, the value of which is calculated (concatenated) from entries on a subform. Accordingly, I've set the control's locked property to true and the tab stop...
1
by: scprosportsman | last post by:
Please help guys, i am trying to set up a database here at work and im fairly new to access in terms of writing functions and queries and stuff. I have 2 different places on my design that will...
1
by: allamaria | last post by:
I am creating a form in Access, in the form there is a checkbox and some fields. I want to set the checkbox so, that if the user clicks on it, the fields should be enabled, if the checkbox has not...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.