By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,960 Members | 2,459 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,960 IT Pros & Developers. It's quick & easy.

Disable field based on entry in another field

P: 41
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

Share this Question
Share on Google+
4 Replies


PhilOfWalton
Expert 100+
P: 1,430
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

P: 41
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, 110 views)
File Type: pdf Form structure.pdf (234.7 KB, 98 views)
Jul 25 '17 #3

PhilOfWalton
Expert 100+
P: 1,430
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

P: 41
Dear Phil

Thanks a lot for your help, it works!!

You are a genius, thank you!

Mike
Jul 25 '17 #5

Post your reply

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