One of the forms on my database contains a five tab page. There are around 20 fields on each page and each page is pretty well a mirror of the others, the data fields on page 1 being identified with trailers of _1, on page 2 _2 etc. For each page there is a database field called IsLocked. When true I want IsLocked_2, for example, to lock certain fields on page 2.
I had success with page 1 using the following code:
(Form on Current procedure)
IF Me![IsLocked_1] = True then
Sales_1.enabled = false
SalesDates_1.enabled = false
EndIf
I am, though, having a problem getting the same code to work for the subsequent pages. When I copy this code for Page 2 then, on opening the form, I get the error message "Compile Error; Method or Data Member not found", the Sales_2.enabled = false line being highlighted.
Am I wrong in trying to conditionally lock fields in this way? If I use an "on Enter" property to set the field as non-enabled this gives an error advising you cannot change the properties of the field whilst it has focus.
Sorry for the long post - can someone tell me where I am going wrong please!
I had success with page 1 using the following code:
(Form on Current procedure)
IF Me![IsLocked_1] = True then
Sales_1.enabled = false
SalesDates_1.enabled = false
EndIf
I am, though, having a problem getting the same code to work for the subsequent pages. When I copy this code for Page 2 then, on opening the form, I get the error message "Compile Error; Method or Data Member not found", the Sales_2.enabled = false line being highlighted.
Am I wrong in trying to conditionally lock fields in this way? If I use an "on Enter" property to set the field as non-enabled this gives an error advising you cannot change the properties of the field whilst it has focus.
Sorry for the long post - can someone tell me where I am going wrong please!