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

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

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
1 1236
ADezii
8,834 Expert 8TB
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

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

Similar topics

2
by: John | last post by:
I have two tables in a 1:M relationship- the parent has 5 fields in the primary key and the child 6 (these are actually pretty far downstream in a complicated ER model, but the problem is between...
1
by: olivier.wambacq | last post by:
hello, This sounds simple but I can't seem to manage... So I'm in a form, and have got a button to "open" (make visible) a subform. the subform actually contains fields from the same table as...
5
by: ApexData | last post by:
I have a Continuous SubForm on a TabPage. Above the ContinuousForm is a "box of fields" I use to display the entire record that the focus is on. When one points to a record using the...
1
by: sirdevo | last post by:
There is one combobox on a subform named Report Soil Series Subform1. The combobox is named cboSoilSeries. I need to disable this so the user can't enter values. I could also disable the whole...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
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
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
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...
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...

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.