Results 1 to 5 of 5
  1. #1
    louise is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    112

    Reset a form's Yes/No checklist on loading or on closing

    Hello,


    I have a Yes/No field in my table that serves as the basis for a checklist -- [BeOnEmailList]. The default value is set to "yes" and all records are "yes" at this point.
    Then, on a form, I have a check box so records can be dropped from the email list (i.e., changed to "no".) and a button on the form opens a query that displays the chosen emails (which are then copied and pasted into Outlook).

    What I would like to do is set all records back to "yes" again after the form closes OR set them all to "yes" as the form opens.

    Can you give me some idea how to do this? Am I correct in putting the field in the table?

    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    Run an UPDATE action:

    CurrentDb.Execute "UPDATE tablename SET fieldname=True"

    Is this a multi-user database? If so, this field in table will not work. Multiple users will conflict.
    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
    louise is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    112
    Hello,
    thanks for your response. I have a couple of questions about it:
    First, I don't think it's what you would consider a multi-user db. There are two people using it, but we use it one at a time from Dropbox. So, we are always using the same db. Does this fall outside of what you were referring to?

    Second, where should I put the update action? On load of the form? On Open? On close of the form?

    Finally, is "CurrentDb" the actual name of my db? and is it the full long name, including location, etc.?

    Can you suggest a better way to do this, perhaps one that doesn't save the field unnecessarily in the actual table?
    thanks,

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The only other alternative I can think of involves a list box and VBA, review: http://allenbrowne.com/ser-50.html

    As long as there is only one user at a time selecting records with the checkbox, should be okay.

    Use CurrentDb just like that - it is an intrinsic constant and Access knows what to do with it.

    Figuring out what event to put code into is the tricky part - form Open or Close should do it, take your pick.
    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
    louise is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Apr 2015
    Posts
    112
    Thank you so much!
    Used the CurrentDb etc and it worked just fine.
    I appreciate your help!

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

Similar Threads

  1. Loading A Form
    By Robert2150 in forum Access
    Replies: 5
    Last Post: 06-24-2015, 01:38 PM
  2. loading empty form
    By Suzie2012 in forum Forms
    Replies: 5
    Last Post: 10-10-2012, 07:03 PM
  3. Possible If statement for loading of a form
    By computer_man20037 in forum Programming
    Replies: 2
    Last Post: 05-16-2012, 09:53 AM
  4. Auto Loading a Form
    By toddbuckles in forum Programming
    Replies: 7
    Last Post: 12-28-2010, 04:20 PM
  5. Reset imageBox on a form?
    By bosve73 in forum Forms
    Replies: 0
    Last Post: 08-11-2010, 07:16 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