Results 1 to 5 of 5
  1. #1
    Artist.Anon is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    22

    Question Clear a form text box when user changes records

    I have a text box (txtProductInfoBox) on my Products form (fProducts) that gets populated with different product information depending on which command button the user presses.



    I display the information requested with VBA code successfully, e.g.

    Code:
    Private Sub ProdInfo_1_Click()
    
    prodinfo = "xxxxxxxxxxxxxxxxxxxxxxx" & "yyyyyyyyyyyyyyyyy" & "zzzzzzzzzzzzzzzzzzzzzz"
    Me.txtProductInfoBox.Value = prodinfo
    
    End Sub
    The problem comes when the user changes records using the navigation bar or PgUp/PgDn, I need to clear the text box. How do I do this? I have tried form initialization, on change events, but either that is not the solution or I am doing it wrong. All suggestions welcomed.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Why do you need to display this concatenated data? This textbox is not bound to a field? Why not just have the expression in textbox ControlSource?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Artist.Anon is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    22
    That was just an example, the actual code does include field values. I have one text box to display three different sets of information depending on which command button the user clicks. All I need is to clear this text box when the user changes records.

  4. #4
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Hi -

    Try clearing the unbound textboxes in the On Current form event. They will be cleared as soon as you move to another record.

    John

  5. #5
    Artist.Anon is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2012
    Posts
    22
    Ah, that was it. Thanks!

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

Similar Threads

  1. Replies: 2
    Last Post: 03-12-2014, 01:31 AM
  2. Replies: 6
    Last Post: 08-07-2012, 02:44 PM
  3. Form text box updates for all records
    By AndrewsPanda in forum Forms
    Replies: 13
    Last Post: 09-28-2011, 11:31 PM
  4. Clear records off of continuous form
    By Ashe in forum Forms
    Replies: 2
    Last Post: 01-04-2011, 12:27 PM
  5. How to clear the form?
    By Mrcams in forum Access
    Replies: 3
    Last Post: 01-03-2011, 12:15 AM

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