Delete content of a text control by code

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ericks
    New Member
    • Jul 2007
    • 74

    Delete content of a text control by code

    What is the code for a button that deletes content of a text control called IntranetLink. The users should have the possibility to delete this link but I noticed that often they click on it with the intention to then hit the Del button. By then of course they are taken to where the link is pointing to. So a Delete button next to the control would make deleting the content more intuitive. I'm sure this is embarrassingly easy but right now my brain went numb.
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Originally posted by Ericks
    What is the code for a button that deletes content of a text control called IntranetLink. The users should have the possibility to delete this link but I noticed that often they click on it with the intention to then hit the Del button. By then of course they are taken to where the link is pointing to. So a Delete button next to the control would make deleting the content more intuitive. I'm sure this is embarrassingly easy but right now my brain went numb.
    Hi. If this is the route you wish to go down it can be achieved by putting the following single VB line in the on-click event of the button:
    Code:
    Me!IntranetLink = Null
    Alternatively you could set the value to a zero-length string.
    Code:
    Me!IntranetLink = ""
    For the zero-length string method to work there must not be a table constraint set that disallows zero-length strings, otherwise an error would occur.

    -Stewart

    Comment

    • Ericks
      New Member
      • Jul 2007
      • 74

      #3
      Thanks a lot. That did it.

      Comment

      Working...