Setting properties in a sub-form

Chrish

New member
Local time
Today, 23:08
Joined
Aug 22, 2012
Messages
9
I am trying to get the properties of enabled and locked set in a continuious subform depending on a yes/no field in each record. I have tried using the answer in thread 160062, (sorry link is not allowed until I have 10 posts) but this only works when it is not a subform (unless I have done something stupid!)If the main form is frmMain and the continuious subform is frmSub, where am I going wrong with this code which is in the subforms Class Objects?Private Sub Form_Current() If Me.MaterialIssue = True Then CRMSignOffDate.Enabled = True CRMSignOffBy.Enabled = True CRMSignOffDate.Locked = False CRMSignOffBy.Locked = False Else CRMSignOffDate.Enabled = False CRMSignOffBy.Enabled = False CRMSignOffDate.Locked = True CRMSignOffBy.Locked = True End IfEnd Submany thanks for your helpChris
 
Do you show more records in the subform?
The code you show will work for the current record. Why did you stop using Me. in the front of the controls, you've it in the If statement?
Code:
If [B][COLOR=Red]Me.[/COLOR][/B]MaterialIssue = True
And please use code tags (click the #), when you post code, else it isn't readable.
 
Many thanks for that, I will give it a try. I could not find out how to make the code show correctly despite many attempts. Having now tried the #, for some reason it does not work possibly because my work IT department has it locked down. The subform displays multiple records each of this should display according to the value in the materialIssue field.
 
.. The subform displays multiple records each of this should display according to the value in the materialIssue field.
It would only work for the current record, so if current record's materialIssue=true all the controls would have the property according to the if condition.
 

Users who are viewing this thread

Back
Top Bottom