Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Clear a textbox after record is saved. (2000)

    How do you clear a text box after the user clicks on a button that saves the record?
    When I try me.fieldname = "" , I get an error. Is there a clear method I can use like in VB.net?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clear a textbox after record is saved. (2000)

    Is this a bound textbox or unbound? The answer depends on the situation. If the textbox is bound, then you don't want to clear it because you would change the record you just saved. If the textbox is unbound, then Me.MyTextbox = Null will clear it. Setting a textbox (which is what I assume you meant by "field") to an empty string doesn't clear it, it replaces the value with an empty string. If the table is set up to not allow zero length strings, then you'll get an error. If you ask a more specific question, you can get a more specific answer.
    Charlotte

  3. #3
    2 Star Lounger
    Join Date
    Oct 2004
    Location
    Evansville, Indiana, USA
    Posts
    111
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Clear a textbox after record is saved. (2000)

    The text boxes are bound. Here is what I have. I have a form that a user will have to input data. Once they fill out the necessary textboxes, they click the save button. I then want them to be able to fill out the form again. That is why I want to clear the form, but I don't want it to put empty strings in over top of the previous record.

  4. #4
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Clear a textbox after record is saved. (2000)

    Then you don't want to clear the form, you want to move to a new record, which can probably be done like this:

    <code>DoCmd.GoToRecord acNewRec</code>

    I say "probably" because how you do it depends on *where* you do it, that is, on the event from which you run the code.
    Charlotte

Posting Permissions

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