Results 1 to 5 of 5
  1. #1
    dabatman is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    3

    Clearing a Form

    I'm trying to clear data that is bound to a table and a query in my form.



    Scenario: In my form I display a table where user can past item numbers into, click get item info button and the results display in a query that's also displayed on the form.

    I need the button to clear the table and query. How would I accomplish this?

  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,929
    Clearing a table means deleting records. Why would you want to do that? If form is bound to table then move to new record for an 'empty' form.

    Show the code for button click event.
    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
    dabatman is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    3
    It's a table that I created just to feed the query. Table is displayed in the form as shown below. User has ability to paste item numbers into the table, click Get Items which feeds the query on the right. I'm looking for a way to reset the information in the form.


  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Don't understand 'feed the query'. What purpose does that serve? You print report then want to wipe out the data?

    Can delete all records from a table with:
    CurrentDb.Execute "DELETE FROM tablename"

    Then refresh the form with:
    Me.Requery
    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.

  5. #5
    dabatman is offline Novice
    Windows XP Access 2007
    Join Date
    Jan 2012
    Posts
    3
    Quote Originally Posted by June7 View Post
    Don't understand 'feed the query'. What purpose does that serve? You print report then want to wipe out the data?
    Think I got it... Access 2007 behaves stragely at times as I did this yesterday with uneffective results.

    Today, I did it and wha-la, it works.

    Solutions:
    Created a delete query to erase the table.
    Created a macro that OpensQuery (the delete query), SelectObject (my form), and then Requery (Control Name of table in form).

    When the Rest button is clicked it runs the above macro which clears out the table for my user so they can paste a fresh set up items numbers in.

    This is just a tool that allows my users to enter item numbers into the form to pull up their cross referenced item to help my user quickly figure out which items would present the best cost.

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

Similar Threads

  1. Clearing a form - having real issues
    By mike_980 in forum Forms
    Replies: 9
    Last Post: 01-11-2012, 06:15 AM
  2. Clearing certain boxes on form for next record using VB
    By justinwright in forum Programming
    Replies: 3
    Last Post: 07-21-2010, 12:16 PM
  3. Error when clearing form
    By turbo910 in forum Forms
    Replies: 11
    Last Post: 11-26-2009, 11:03 AM
  4. clearing a form
    By macsterling in forum Forms
    Replies: 0
    Last Post: 07-31-2008, 10:38 AM
  5. Clearing the clipboard with VBA?
    By Simon Sweet in forum Programming
    Replies: 1
    Last Post: 04-17-2008, 03:16 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