Results 1 to 4 of 4
  1. #1
    sevanty7 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    37

    Question Clearing a textbox if its already empty

    Hello
    I currently have numerous textboxes on a form. I have a button called Clear
    the code i've been using to clear my textboxes is the textbox.value = ""
    for example for the textbox called description i have



    description.value = ""

    this works great when there is data in the textbox but there isn't anything it has a run time error. is there and "or" or "if" function i can run to stop this from happening?

    Thanks for any help!

  2. #2
    Beetle is offline Unrelatable
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    Camp Swampy (Denver, CO)
    Posts
    207
    What is your exact code (copy and paste here from your module) and what is the run time error message?

  3. #3
    sevanty7 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    37
    My current code is

    FileID.Value = ""
    Description.Value = ""
    Process.Value = ""
    Street_Num.Value = ""


    However if a record were to have no value in the "Process" textbox for example the run time error will highlight the ".value" beside the word Process.

  4. #4
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    What is the "Process" textbox bound to? When you get the error, bring up the immediate window and type
    Code:
    debug.print Me.Process.value
    CHECK STEP ONE - About the time you type the second period, the programming interface should pop up Value as a suggestion for the property that you are looking for. If it does not do that, then there might be something wrong with the textbox itself - make a copy of the database, and in the test copy, delete that control and recreate it from scratch. See if that solves your problem.

    CHECK STEP TWO - Hit enter and see what value you get. If you are dealing with a NULL, then you could try code something like
    Code:
    If Process.Value Is Not NULL then 
       Process.Value = ""
    End if
    CHECK STEP THREE - Review the field table to which the Process textbox is bound. Verify that the field in the table is set up to allow zero-length strings. If not, then add one space to the string that you are assigning.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 04-23-2012, 10:13 PM
  2. Empty textbox crash
    By deepin125 in forum SQL Server
    Replies: 6
    Last Post: 04-03-2012, 02:55 PM
  3. Clearing a Form
    By dabatman in forum Forms
    Replies: 4
    Last Post: 01-20-2012, 11:51 AM
  4. Replies: 4
    Last Post: 11-20-2011, 01:08 PM
  5. Replies: 4
    Last Post: 06-29-2011, 06:32 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums