sub txtBox_afterupdate()
Txtbox2.locked= isNull(txtBox1)
txtbox3.locked=txtbox2.locked
txtbox4.locked=txtbox2.locked
end sub
In design mode ,set all the field property LOCKED =true. (Except the 1)
then in the 1 field, in the AFTERUPDATE event, then unlock all other fields ....
Code:sub txtBox_afterupdate() Txtbox2.locked= isNull(txtBox1) txtbox3.locked=txtbox2.locked txtbox4.locked=txtbox2.locked end sub
What is the error?
Also why do this? If you have users who try to enter student information without student ID's they will quickly learn by experience that that is a stupid thing to do (because it just won't work). No need for complicated code that is unnecessary.
You probably should not have things like student name in a subform. It's part of the student record, not a child of the student record. Locking fields is not a typical requirement for access development of forms. Naturally, once you are familiar with design principles you can do whatever you like but at first try to use the forms in a standard way and don't use a lot of code.
Okay. I guess I thought you had fields for student name because of the field that you named Student_Name. My bad!