hi, is that possible to set a value on a locked textbox?
if yes, could plez show me some example coz i got error when try to set value in to a locked textbox.
if no, what are the alternatives to put value inside a locked control?
Printable View
hi, is that possible to set a value on a locked textbox?
if yes, could plez show me some example coz i got error when try to set value in to a locked textbox.
if no, what are the alternatives to put value inside a locked control?
In VB, you can put the textbox in a frame, and lock the frame but not the textbox. Not sure if you can do it in VBA, but I think you can.
You can set the enabled property to true on the textbox, and false on the frame so that you can change the text value.
Otherwise, you have to enable it to write to it.
one thing that wonder me is, if i set a textbox locked to true, the access still could update the form? i mean this is unfair, why access could update my locked control while i can't?
You can lock the control in vb too (I think) but in vba all it means is that the user cannot change what is displayed in it.
Via code you can and if you have bound that textbox to a field, changing it via code will probably be saved.
Problem with bound forms ;)
i found out one tricks :)
VB Code:
Text1 = "VBA"
VB Code:
Text2.Text = "VBA"
the first one wouldn't generate any error,
but the second one would generate following error
Run-time error '2185':
You can't reference a property or method for a control unless the
control has the focus.
two of them are set locked = true
hope this would help people who got such similiar problem :)