Results 1 to 13 of 13
  1. #1
    erez is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    6

    Macro

    Hi

    How to Write macro for a button, that Change Yes/No in a form?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Why?

    Why not bind Checkbox or Toggle button to Yes/No field?
    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
    erez is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    6
    Tha button is sending a email. I need to report that tha mail send by Yes/No.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Explore the SetValue method in macro. In macro designer, click the ShowAllActions ribbon button.

    I don't use macros. In VBA, like:

    Me!yourfieldname = True
    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
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    You could have a toggle button or checkbox that will indicate whether an email is sent. If the value is -1 (which corresponds to a check) then send the email, else if the value is 0 (unchecked) email is not sent.

    But, why do you need a Yes/No for sending an email..? What else will this button be doing? If the button is only sending an email you place a line of code behind the button so that when clicked an email is sent, I see no need for to toggle Yes/No.

  6. #6
    erez is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    6
    I have to update the data, those who send mail.

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Did you attempt code as suggested? Is this resolved?
    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.

  8. #8
    nick404's Avatar
    nick404 is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Location
    Wisconsin
    Posts
    352
    Still kind of confused by what exactly you are trying to accomplish.
    You have a button to send an email, and when it is sent you want a field to contain 'Yes', and if it hasn't been sent, or failed to send you want the field to contain 'No' ,is this what you are going for?

  9. #9
    erez is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    6
    no it didnt work

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    What does that mean, what happened - error message, wrong results, nothing? What exactly did you try? Post code for analysis.
    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.

  11. #11
    erez is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    6
    This is mush more dene i need.
    I need that the field to contain Yes after the button.


  12. #12
    erez is offline Novice
    Windows 8 Access 2016
    Join Date
    Jan 2016
    Posts
    6
    I tried several ways:
    me!fieldname = True
    me![fieldname] = True
    as a sub macro


  13. #13
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Did you use your actual field name?

    You mean a VBA Sub procedure? In what event?

    Macros are very different from VBA.
    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: 1
    Last Post: 01-21-2015, 02:02 PM
  2. Replies: 1
    Last Post: 01-13-2015, 01:33 PM
  3. Command Button to Run Macro, can't find macro
    By Ace2014 in forum Modules
    Replies: 22
    Last Post: 06-11-2014, 11:42 AM
  4. Replies: 2
    Last Post: 05-05-2012, 02:34 AM
  5. Replies: 0
    Last Post: 01-12-2011, 12:43 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