Results 1 to 3 of 3
  1. #1
    tdoolittle is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2014
    Posts
    18

    Within 24 Hours Prompt Message Box

    Hey guys,



    Stuck again, and have lots of success on here so I'm back!

    Trying to streamline a job duty we have and hoping you can help.

    Have a command button that when clicked sends emails to everyone we need to, works totally fine. This button does LOADS of other stuff with our records and it all works, but now I have a new requirement where we can not send emails out within 24 hours of each other.

    So now when we click this button to send our emails, a record is added to a table with a Now() time stamp to show when we last sent emails. As I don't trust everyone to view the field I've put on my form to show the most recent time emails were sent I'm trying to make a message box pop up if our send emails button is being hit within 24 hours of the most recent time field.

    So if I sent emails yesterday at 2PM (7/30/2014 2:00:00 PM) and I click the button today at 1:55PM (7/31/2014 1:55:00 PM) I want a message box to appear telling the user to try again later.

    I had this working fine as we were under the rules of not sending emails twice in one day, so my field use to populate with Date(), and my code would reference "If Me.Emails_Last_Sent = Date() Then..." and my message box was fine. But now that calculating time within 24 hours is involved I'm heavily confused....

    Hopefully not a repeat question, searched around the forums, didn't see anything that gave me an epiphany I usually get!

    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
    53,626
    Maybe:

    If Me.Emails_Last_Sent >= DateAdd("h", -24, Now()) Then
    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
    tdoolittle is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Apr 2014
    Posts
    18
    Well... guess I was looking way too far into it! Thank you so much, June! We are all set!!

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

Similar Threads

  1. Replies: 1
    Last Post: 08-08-2012, 01:42 PM
  2. Replies: 4
    Last Post: 08-06-2012, 10:25 AM
  3. Query parameter prompt - Format message
    By daved292 in forum Queries
    Replies: 2
    Last Post: 06-08-2012, 11:09 AM
  4. How to put a prompt message inside a text box
    By usmcgrunt in forum Forms
    Replies: 3
    Last Post: 11-05-2010, 09:55 AM
  5. Replies: 5
    Last Post: 03-04-2010, 05:41 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