473,499 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Automatically activate checkbox when Combobox-field is not empty

41 New Member
Hello

It is me again. I have another issue that I can not solve by myself or with google and would be happy if you could help me.

My database consists a form with details of persons. There is a subform with a combobox that consists "languages" and there is a checkbox on the mainform (yes/no) with the name "Translator".

I would like that the checkbox "Translator" is automatically activated if a language from the combobox in the subform is chosen and vice versa. What I would like in addition, is that the checkbox can not be activated or deactivated manually by the enduser of the form.

Can anybody tell me how I can do that?

Greetings and thanks!!

Mike
Aug 7 '17 #1
16 1491
PhilOfWalton
1,430 Recognized Expert Top Contributor
With the number of answers I have provided, I might just as well have written your DB

Firstly if you have a Combo box for languages, you restrict the person to only 1 language,

Secondly, from your description of what you want, if a language is selected, by definition the person is a translator, so there is no point in the translator checkbox.

Thirdly, with only one language allowed, this should be a Combo box in your main form, so what is in your subform?

Do you need a rethink?

Phil
Aug 7 '17 #2
MikeMikeCH
41 New Member
Dear Phil

Thanks a lot, and yes, you have provided really a lot of answers for which I am very thankful!! I hope I won't have many more questions...

I have a subform in which is a combobox with languages. For each person, more than one language can be chosen. The languages are in an individual "page" in a subform. On the main page of the form, I have the checkbox with the languages so that you see just in a second whether a person can be asked for translation or not. Therefore, the checkbox.

Greetings

Mike
Aug 7 '17 #3
PhilOfWalton
1,430 Recognized Expert Top Contributor
OK Mike, that's clear, but are you saying that if a person has any language then they can translate ALL the languages listed on the subform, or are you saying that they are good at some languages which they can translate, and have limited ability in other languages? In which case the checkbox should be on the subform.

If it is the former, I still can't see what the check box achieves as an entry on a subform is far easier to see than a tick in a chec box.

Phil
Aug 7 '17 #4
MikeMikeCH
41 New Member
Dear Phil

Thanks for your answer. My question is about the former situation, meaning that when a language is in the combo, then the person can do the translation for that language and is a translator.

The checkbox is to make it much faster visible for the user of the database. To understand that, I send you a short attachment.

Mike
Attached Files
File Type: pdf model.pdf (31.5 KB, 126 views)
Aug 7 '17 #5
PhilOfWalton
1,430 Recognized Expert Top Contributor
OK. First set the Translator Check Box to Locked = Yes. That stops manual changing.

Then on current of the main form you need something like
Expand|Select|Wrap|Line Numbers
  1. ChkTranslater = [LanguageSubForm].[Form].RecordsetClone.RecordCount > 0
  2.  
So see if there are any language records and set the Translator box accordingly.

You will need a similar routine on the After Update of the language subform

Phil
Aug 7 '17 #6
MikeMikeCH
41 New Member
Dear Phil

I could not really succeed, sorry. I have a main form in which the checkbox is situated, a subform and a combobox in the subform.

If you feel tired of helping me, I am really sorry. I will try not to poste more questions after that problem...

Thanks!

Mike
Aug 7 '17 #7
PhilOfWalton
1,430 Recognized Expert Top Contributor
More than happy to help. Mike.

So what's the name of your subform?
Is there any information on it other than the language?
What code did you try?

Phil
Aug 7 '17 #8
MikeMikeCH
41 New Member
Dear Phil

Thank you!

The name of my SubForm is "T_Sprache-Unterformular". There is no other information on it than just the languages in the combobox "cmbSprache" out of the table "T_Sprache".

The mainform where the checkbox "Checkbox Übersetzer" is, is called "MainForm".

I tried the code you sent me on the Combo and additionally on the main form. It did not work, therefore I tried to put the Code on the Subform instead of the main form. I did the same with codes like the following, without success:

If Me.cmbSprache = 1 Then
Me.Checkbox_Übersetzer = True
Else
Me.Checkbox_Übersetzer = False
End If

I tried different codes like that which I found in the internet...

Mike
Aug 7 '17 #9
PhilOfWalton
1,430 Recognized Expert Top Contributor
I'll try to get my head round the German

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.  
  3.     Übersetzer = T_Sprache-Unterformular.Form.RecordsetClone.RecordCount > 0
  4.  
  5. End Sub
  6.  
In even better way if this is so important would be to have a great big label called LblÜbersetzer with the Caption Übersetzer and change the code to

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.  
  3.     LblÜbersetzer.Visible  = T_Sprache-Unterformular.Form.RecordsetClone.RecordCount > 0
  4.  
  5. End Sub
  6.  
Phil
Aug 7 '17 #10
MikeMikeCH
41 New Member
Dear Phil

Thanks a lot for your answer. Do I have to put this VBA-Code into the checkbox and in the main form? Where would I have to put it in the Checkbox (by click or by what?)?

Thank you

Mike
Aug 8 '17 #11
PhilOfWalton
1,430 Recognized Expert Top Contributor
You need it in the On Current of your main form so that as each main form record is read, a check is made on the number of records in the subform.

On the Subform you need
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_AfterUpdate()
  2.  
  3.     Me.Parent!Übersetzer = Me.RecordsetClone.RecordCount > 0
  4.  
  5. End Sub
  6.  
So here we see if there are any languages in the subform, and change the check box in the parent (MainForm) accordingly.

Phil
Aug 8 '17 #12
MikeMikeCH
41 New Member
Dear Phil

Thanks a lot, I have tried many codes, unfortunately without success:

Main Form
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. CheckBox Übersetzer = T_Sprache- Unterformular.Form.RecordsetClone.RecordCount > 0
  3. End Sub
  4.  
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. Übersetzer = T_Sprache-Unterformular.Form.RecordsetClone.RecordCount > 0
  3. End Sub
  4.  
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. CheckBox_Übersetzer = T_Sprache- Unterformular.Form.cmbSpracheClone.RecordCount > 0
  3. End Sub
  4.  
The whole thing also on the subform with the basis of:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_AfterUpdate()
  2. Me.Parent!Übersetzer = Me.RecordsetClone.RecordCount > 0
  3. End Sub
  4.  
I have also tried to put the name of the checkbox and of the other data in brackets, but it did not work out.

Can you tell me what I am doing wrong?

Thank you!

Mike
Aug 8 '17 #13
PhilOfWalton
1,430 Recognized Expert Top Contributor
Mike, I have no idea what you are doing wrong.

It certainly works on my test database.

Can I suggest to send me a copy of your Db (with sensitive information stripped out).

Use the Private Message Option

Phil
Aug 8 '17 #14
MikeMikeCH
41 New Member
Dear Phil

How can I send you an attachment in the Private Message Option? I could not find an option to make an attachment.

Mike
Aug 8 '17 #15
PhilOfWalton
1,430 Recognized Expert Top Contributor
Hi Mike

See your Private Messages

Phil
Aug 8 '17 #16
MikeMikeCH
41 New Member
Phil helped me to solve the problem, thanks a lot! The VBA-Codes are like that:

Main form

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. [Checkbox Übersetzer] = [T_Sprache-Unterformular].Form.RecordsetClone.RecordCount > 0
  3. End Sub

Subform

First VBA After Update:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_AfterUpdate()
  2. Me.Parent![Checkbox Übersetzer] = Me.RecordsetClone.RecordCount > 0
  3. End Sub
Second VBA AfterDelConfirm
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_AfterDelConfirm(Status As Integer)
  2. Me.Parent![Checkbox Übersetzer] = Me.RecordsetClone.RecordCount > 0
  3. End Sub
Thank you very much, Phil!!!
Aug 9 '17 #17

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

Similar topics

2
7459
by: Jason McDonald | last post by:
I have a PDF form that has a combo box "no_wireless_mics" with the values "1" "2" and " " where " " is the default. I need a JavaScript that will cause the check box "wireless_mics" to be checked...
5
3660
by: wolf_y | last post by:
My question is simply: under what conditions will empty tags of the form <MOM></MOM> pass schema validation? Of course, the mirror question is: under what conditions will empty tags fail...
1
1316
by: arun.hallan | last post by:
Hi, I have two columns in a datagrid that are filled with checkboxes. I want one checkbox in a row to be checked when the corresponding checkbox is checked. I've added an OnCheckedChanged...
1
1827
by: ayeung | last post by:
Hi, I have written a GUI application that I want to automatically run on a Linux system (Fedora Core 6) upon powerup. I've created a script which runs correctly and have added a run script using...
2
5007
by: tvnaidu | last post by:
How can I disable checkbox when it is selected Kernel?. <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr><td align="right" width="40%" valign="top"...
5
13811
by: yappy77 | last post by:
I am trying to change the label color of a checkbox on a subform if it is checked. The code I have so far is: Private Sub Emergency_Contact_Click() If Me.Emergency Contact = True Then...
1
1632
by: debre | last post by:
hi, i m new to asp.net n i m tryin to work wit datagrid. my prob is tat...when i click the header checkbox all d checkbox in the first page is selected n when i go to d sec page in datagrid..the...
0
1210
by: TensE | last post by:
How do I make specific checkboxes be checked when I select an entry in a combobox? Like if I select entry 1 checkbox 1 and 3 will be checked if entry 2 then 3 and 4 be checked? So far I'm...
4
8575
by: tamcq | last post by:
When my database is opened, it starts with the form Patients.Page 2 of the the Patients form contains a subform called New Record. This New Record subform is where you put entries about the...
0
7132
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
7178
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,...
0
7223
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6899
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
7390
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
5475
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,...
1
4919
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...
0
1427
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 ...
0
302
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.