Results 1 to 4 of 4
  1. #1
    kmims44 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    24

    Need Code and or directions to use command button to clear 2 fields

    so this is going to sound a bit confusing but hopefully you can follow and help me out. I created a form regarding parts/pricing data etc. Now one of the fields is "Add to Quote" and it is a checkbox (true/False Yes/No) option and another field is "Quote Buy QTY" which is a number. Now, I have created a command button that uses a query to find all the parts that have a true value for the "Add to Quote" field and then open a report to view the information...Essentially a quote. Now my problem is...I would like to create a command button that would return the "add to Quote" field to Null as well as the "Quote to Buy QTY" field to a blank field so that when another user uses teh database they do not have to search for records that may accidentaly still checked. Can anyone help me troubleshoot this please?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    You want to reset these two fields in all records? That is an UPDATE sql action.

    Code in VBA:

    CurrentDb.Execute "UPDATE tablename SET [Add to Quote] = False, [Quote Buy QTY] = 0;"
    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
    kmims44 is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    May 2012
    Posts
    24
    Thanks very much worked perfectly! Can you also tell me how to create a user-friendly search feature...the find record command brings up the find/replace tool but I was wondering if there was a better way to do this

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,625
    For parameterized query approach (query would be the RecordSource of form), review tutorials at http://datapigtechnologies.com/AccessMain.htm especially 'Build a Custom Filter in Your Form' and 'Creating a Basic Search Form' in Access Forms: Tips and Techniques section.
    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.

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

Similar Threads

  1. Replies: 12
    Last Post: 03-14-2012, 10:54 AM
  2. Command Button Wizard and Matching Fields
    By tylerg11 in forum Forms
    Replies: 5
    Last Post: 10-07-2011, 01:07 PM
  3. Command button code to clear form
    By windwardmi in forum Forms
    Replies: 15
    Last Post: 11-21-2010, 03:21 PM
  4. Form/report command button code
    By max3 in forum Forms
    Replies: 1
    Last Post: 08-26-2009, 02:18 AM
  5. Command button code
    By lfolger in forum Forms
    Replies: 3
    Last Post: 03-25-2008, 04:26 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