Results 1 to 6 of 6
  1. #1
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142

    Bound text box in a form to display empty when opened

    Hello Everyone



    I have few text boxes they are all bound to a table in a form. But whenever I open the form, I don't want them to hold the previous values. I want the textboxes to be empty.
    I have tried keeping this code in the onload form
    Code:
    Me.Textbox1.value = ""
    But its not working.


    Can anyone help me with this.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    If you want to add new records, open the record in data entry mode (an argument of OpenForm).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142
    Thank you for replying.
    The data entry mode is set to yes in the form.

    Click image for larger version. 

Name:	Pic1.png 
Views:	6 
Size:	6.3 KB 
ID:	35494

    The form opens with bound valued textboxes but once the users enters the input, it saves into another table.
    and the next time when form is opened, I don't want text box holding previous values.
    I am not keeping the unbound because the form is a continuous form.
    And many new records are added to it.


    Quote Originally Posted by pbaldy View Post
    If you want to add new records, open the record in data entry mode (an argument of OpenForm).

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    I'm confused. If the form is in data entry mode, it should not show any existing records. Are you sure it's not a default value that's displaying? Can you attach the db here?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Shamli is offline Competent Performer
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jul 2018
    Location
    California
    Posts
    142
    Hi. Sorry for updating the answer late. I found a solution as soon as I read your reply. I don't know why that happens every time .Thank you so much for giving me hints all the time.

    Below is the code I used.

    Code:
    On Error Resume Next
     With Me.RecordsetClone
     .MoveFirst
     Do While .EOF = False
     .Edit
     .Fields("CarID").Value = ""
     .Fields("Origination").Value = ""
     .Fields("Destination").Value = ""
     .Fields("Purpose").Value = ""
     .Fields("Total Miles").Value = ""
     
     .Update
     .MoveNext
     Loop
     End With
     
     Application.SetOption "Confirm Action Queries", 0
    Quote Originally Posted by pbaldy View Post
    I'm confused. If the form is in data entry mode, it should not show any existing records. Are you sure it's not a default value that's displaying? Can you attach the db here?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Glad you got it working.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 8
    Last Post: 02-07-2017, 09:58 AM
  2. Replies: 6
    Last Post: 01-30-2014, 05:57 PM
  3. Text appearing every time form is opened.
    By lmjje in forum Programming
    Replies: 2
    Last Post: 01-04-2013, 09:25 AM
  4. Form bound control display
    By Daryl2106 in forum Access
    Replies: 5
    Last Post: 12-11-2012, 08:56 AM
  5. Replies: 7
    Last Post: 10-03-2011, 12:44 PM

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