Results 1 to 5 of 5

Thread: [Resolved] how to set value on locked textbox?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    158

    Resolved [Resolved] how to set value on locked textbox?

    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?
    Last edited by asmdev; May 21st, 2005 at 05:56 PM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: how to set value on locked textbox?

    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.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    158

    Re: how to set value on locked textbox?

    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?

  4. #4
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343

    Re: how to set value on locked textbox?

    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

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    158

    Re: how to set value on locked textbox?

    i found out one tricks

    VB Code:
    1. Text1 = "VBA"

    VB Code:
    1. 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width