473,396 Members | 1,921 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,396 software developers and data experts.

Disable field based on entry in another field

Hello everybody

I have a similar question to the one that was posted with the title of my question on december 21 2006. But my situation is a bit different.

I am working on a database which contains persons who participate on different seminaries during a specific period of time. After each seminary they receive a diploma if they were not missing more than for example have a day of the seminary.

On my access form, I can select/connect each person with multiple seminaries. For each seminary I can write in a txtfield the number of days a person was missing in this seminary. What comes next is that I have a Checkbox for each seminary(diploma received yes/no). I would like (for each seminary) that the Checkbox is blocked if there is written anything in the txtfield mentioned before. The Checkbox shall only be activated if the txtfield is empty.

I tried to do it with this VBA-Code:

Private Sub B_Absenz_HT_AfterUpdate()
If Not IsNull(Me.B_Absenz_HT) Then
Me.B_Diplom.Locked = True
Else
Me.B_Diplom.Locked = False
End If
End Sub

It works, but not for each seminary separately but only for all the seminaries together, which is not convenient.

I would be very happy if somebody could tell me how that I can change this VBA-Code so that it only connects with one single seminary.

Thanks a lot!

Mike
Jul 24 '17 #1

✓ answered by PhilOfWalton

Hi Mike.

If this doesn't solve the problem, I would certainly suggested posting it under "Access"

I think what you have got is fine, assuming the Zertificat on your form is bound to the B_Diplom in your table.

I think what you are missing is to lock and unlock the B_Diplom on the OnCurrent of the subform

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.  
  3.     If Not IsNull(Me.B_Absenz_HT) Then
  4.         Me.B_Diplom.Locked = True
  5.     Else
  6.         Me.B_Diplom.Locked = False 
  7.     End If
  8.  
  9. End Sub
  10.  
I just have a suspicion from your first posting that you may not have B_Diplom as the ControlSource of Zertificat.

Phil

4 6256
PhilOfWalton
1,430 Expert 1GB
Firstly, Mike, this question should have been posted under "Access", not "Desktop Software" which is why you are getting no answers.

So what is your table structure?
Is this a form based on the students and a subform for the seminars?
Is the checkbox bound to a field?

Phil
Jul 25 '17 #2
Dear Phil

Thanks a lot for your answer and for the information about the post. Now I understand the reason why I don't get answers. Do you think I should repost it under "Access"?

I link two documents as an attachment. One with the table structure and another with the form structure. My wish would be (please have a look at the form structure) that if there is written anything in the field "Absenz (HT)" or "Absenz Grund" that the Checkboxes "Zertifikat" AND "Eintrag Ausbildungspass" are blocked and vice versa.

Thanks a lot for helping me. If you need more information, please let me know.

Mike
Attached Files
File Type: pdf Table structure.pdf (28.2 KB, 200 views)
File Type: pdf Form structure.pdf (234.7 KB, 191 views)
Jul 25 '17 #3
PhilOfWalton
1,430 Expert 1GB
Hi Mike.

If this doesn't solve the problem, I would certainly suggested posting it under "Access"

I think what you have got is fine, assuming the Zertificat on your form is bound to the B_Diplom in your table.

I think what you are missing is to lock and unlock the B_Diplom on the OnCurrent of the subform

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2.  
  3.     If Not IsNull(Me.B_Absenz_HT) Then
  4.         Me.B_Diplom.Locked = True
  5.     Else
  6.         Me.B_Diplom.Locked = False 
  7.     End If
  8.  
  9. End Sub
  10.  
I just have a suspicion from your first posting that you may not have B_Diplom as the ControlSource of Zertificat.

Phil
Jul 25 '17 #4
Dear Phil

Thanks a lot for your help, it works!!

You are a genius, thank you!

Mike
Jul 25 '17 #5

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

Similar topics

6
by: jochen scheire | last post by:
Is there a way I can calculate a field in a form based on another field in the same form. When clicking submit, both values should be posted to the next page. I want to be able to type in a value...
6
by: Greg | last post by:
I am trying to change the value of one field in my query based on the value in another. If Field 1 had the text "ONACCNT" then in Feild 2 I want the date to change to today's date. Any help would...
1
by: john_liu | last post by:
I have a field called AMOUNT in MS Access with values of 10, 20, 30, 40, and I want to create another field called TOTAL like this: if the value in field AMOUNT=20, then TOTAL=AMOUNT*3, else...
1
by: compl | last post by:
I have a database that I need to restrict the ability to edit one field based on another. The two fields are DOS (date) and Amount (currency). I only want the users to be able to edit the Amount...
2
by: yesgirl | last post by:
Hello, In an Access 2003 form, I have a combo box that offers numerous selections. If certain values are chosen (i.e. "Done") then a date in another field in the form must be entered...
2
by: Coll | last post by:
I have a field that I would like to display on a report only if the value of another field matches a certain criteria. If it does match I need the label & the field value to display (though I'm...
3
by: PowerLifter1450 | last post by:
Hi all, I have to Combo boxes on a form. The first one I would always like users to see. The second, however, I would like hidden if the first box has certain values selected. So, if ComboBox1 has...
2
by: MyWaterloo | last post by:
Ok. I have a form with a field for a sampler's name, number, and email address. The sampler's name is selected from a combo box that references a table with name, number, and email. I want to be...
11
by: clloyd | last post by:
I have a phone number field (BusinessPhone) that I only want to display in my query results if the user has selected yes (yes/no field) in another field (Business Y/N field). The premise is that...
5
by: jolaunt | last post by:
I am trying to create a vba code to tick a box after an update of another box. I have a yes/no drop down box called 'ResolvedByTelCall'. When 'yes' is selected I want a tick to go in another box...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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:
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.