J
JK
Hi,
Quite often I need to protect the details part of a form from changes, yet
allowing users to have a look at it. eg. Invoice which has been invoiced -
thus no changes can be made any longer. The protection is in the details
part of the form - The Form header has a combo which search for Invoices,
therefore turning off the AllowEdits will turn off the search
Until now I simply used the WITH for each field. eg:
With Payee_ID
.ForeColor= vbWhatever
.Locked=True
.Enabled=False
End with
With Inv_Date
.ForeColor= vbWhatever
.Locked=True
.Enabled=False
End with
etc.
This is quite tedious as I need to do in many forms. Is that an easier way
of doing it?
I tried the Form(FileldIndexNumber) function to see whether I can use the
For Next but I can make no sense how the FieldIndexNumbers are allocated.
Form(0).Name gives me a filed in the header, Form(7) gives me a label which
belongs to a field in the details section *but* this is not the control
name for of that label.
Can anyone help me there in:
1. What is the index number in Form(Index), regardless of my problem.
2. Is there a better way (then the "With" Statement) of going through the
fields in the form to protect (or unprotect) them?
TIA
Regards/JK
Quite often I need to protect the details part of a form from changes, yet
allowing users to have a look at it. eg. Invoice which has been invoiced -
thus no changes can be made any longer. The protection is in the details
part of the form - The Form header has a combo which search for Invoices,
therefore turning off the AllowEdits will turn off the search
Until now I simply used the WITH for each field. eg:
With Payee_ID
.ForeColor= vbWhatever
.Locked=True
.Enabled=False
End with
With Inv_Date
.ForeColor= vbWhatever
.Locked=True
.Enabled=False
End with
etc.
This is quite tedious as I need to do in many forms. Is that an easier way
of doing it?
I tried the Form(FileldIndexNumber) function to see whether I can use the
For Next but I can make no sense how the FieldIndexNumbers are allocated.
Form(0).Name gives me a filed in the header, Form(7) gives me a label which
belongs to a field in the details section *but* this is not the control
name for of that label.
Can anyone help me there in:
1. What is the index number in Form(Index), regardless of my problem.
2. Is there a better way (then the "With" Statement) of going through the
fields in the form to protect (or unprotect) them?
TIA
Regards/JK