Results 1 to 2 of 2
  1. #1
    Bongobob21 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    29

    Setting all Searchfields in a Form to Default value

    Hi,

    I want to insert a delte button into my Form to set all fields on the form totheir feault value. As i have many forms and many searchfields in them, I wanted to know if there is a command setting all sarchfields of a form it their default value. Otherwise it would be a lot of work to reste all fields one by one.



    Thanks in advance

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,445
    depends how your form is set up, but you can loop through each control to reset

    Easiest way is probably to use the control tag property to indicate which are search fields - e.g. for those controls you want to reset put say 'searchfield' (no quotes) in the tab property

    then for the code behind your reset button put

    Code:
    dim ctrl as control
    for each ctrl in me.controls
        if ctrl.tag="searchfield" then ctrl.value=""
    next ctrl

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

Similar Threads

  1. Setting default value on a form from a Query
    By rjgriffin46 in forum Access
    Replies: 18
    Last Post: 12-12-2014, 02:37 PM
  2. Setting default value to zero in form box?
    By dekhelia in forum Forms
    Replies: 6
    Last Post: 10-17-2013, 08:53 AM
  3. Replies: 6
    Last Post: 10-20-2012, 04:45 PM
  4. Setting default value for all records in form
    By robsworld78 in forum Forms
    Replies: 15
    Last Post: 08-14-2011, 12:48 AM
  5. Form Field Default Setting
    By roofbid in forum Programming
    Replies: 3
    Last Post: 12-17-2010, 10:53 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