Setting control property with VBA stopped working

joeKra

Registered User.
Local time
Today, 10:03
Joined
Jan 24, 2012
Messages
208
Hi Guys
as strange it appears it happened !
i have a VBA routine to lock\unlock controls on a form; the code is in a standard module (outside the form) where it calls the form using Form_FormName.ctrl.locked = true\false
after running the sub and checking in immediate window (?Form_FormName.ctrl.locked) it returns as desired (false\true) but it does not actual reflect the form' ctrl neither showing in forms property sheet. any suggestions ?

i tried to recreate the whole app; save form as text and reload but neither helped
thanks in advance
 
I am not sure on what you are trying to do. But if you are locking controls using VBA then you will not see this in the properties of the form. If you run the form & the VBA you should be able to see if the controls are locked.

The properties box shows the state of the form when it is first loaded and not after the VBA has run :o:o

T
 
thanks for reply. i must agree that's relative news for me. anyhow. till now it was reflecting the control, But suddenly it doesn't listen to me :( what could it be ?
 
Show you code, also from the module where you call the code.
 
where it calls the form using Form_FormName
Using the Form_FormName construct does not work the way you think it does. If you want to be sure that your standard module code operates on a specific form, pass a Form reference to that routine, for example . .
Code:
Sub DoSomethingToForm1(frm as Form_Form1)
[COLOR="Green"]   'this routine modifies a property of a Form1 instance[/COLOR]
   frm.Caption = "Modified: " & now()
End Sub

Call that code from Form1 with code like . . .
Code:
Sub cmd_Click()
[COLOR="Green"]'  calls the routine, passing in a reference to Me[/COLOR]
   DoSomethingToForm1 Me
End Sub
 
Final !
i've restructure the code with RaiseEvent 's so every form takes care of itself :)
 

Users who are viewing this thread

Back
Top Bottom