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

how to disable fields in subform or how to disale the subform

P: 2
Hello Everyone, in my access application, I have two tables that are

1. tblStudents where studentID is the pk (Primary Key)
2. tblExam where ExamID is the pk and fkStudentID is the foreign key

I have a form called students that displays information about a individual student and below I have a exam subform that Displays Exams taken by that individual student.

However I only want the Exam subform to be enabled if the user check the checkbox “Exam Taken”. So if it is not check that it should be disabled. Could anyone please guide me how do I go about doing that in VBA.

Thanks for all your help.
Ket
Sep 11 '07 #1
Share this Question
Share on Google+
1 Reply


ADezii
Expert 5K+
P: 8,636
Hello Everyone, in my access application, I have two tables that are

1. tblStudents where studentID is the pk (Primary Key)
2. tblExam where ExamID is the pk and fkStudentID is the foreign key

I have a form called students that displays information about a individual student and below I have a exam subform that Displays Exams taken by that individual student.

However I only want the Exam subform to be enabled if the user check the checkbox “Exam Taken”. So if it is not check that it should be disabled. Could anyone please guide me how do I go about doing that in VBA.

Thanks for all your help.
Ket
You need to place Duplicate Code in the Form's Current() Event and also in the AfterUpdate() Event of the [Exam Taken] Check Box as indicated below (replace subfChild with your SubForm Name):

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Current()
  2. If Me![Exam Taken] Then
  3.   Me![subfChild].Enabled = True
  4. Else
  5.   Me![subfChild].Enabled = False
  6. End If
  7. End Sub
Expand|Select|Wrap|Line Numbers
  1. Private Sub Exam_Taken_AfterUpdate()
  2. If Me![Exam Taken] Then
  3.   Me![subfChild].Enabled = True
  4. Else
  5.   Me![subfChild].Enabled = False
  6. End If
  7. End Sub
Sep 11 '07 #2

Post your reply

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