Results 1 to 7 of 7
  1. #1
    rshaw63 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    32

    Is There a way to make this work?

    Hello Everyone,



    I was wondering if it was possible to when my access application loads to main screen i would like to check dates in a table field and automatically send an email to one person if the date matches current date. I have seen how to create a button to do this but i was wanting this automated as so i didnt miss any dates. the field is time critical so it has to been renewed by the date

    Click image for larger version. 

Name:	Capture.PNG 
Views:	21 
Size:	31.8 KB 
ID:	46338

    As you can see above when the Renewal_Date field = now() send email to caller email.

    thanks in advance for all that you guys do.

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Just put the code you would use for a button in the load event of the main screen.
    What happens if the user opens the db more than once in the day?
    You would not use now(), but date()
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    rshaw63 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Mar 2020
    Posts
    32
    Usually The Application once opened stays that way for the day.

    So i have a form called mainmenu that default loads when the application is started put that code on the load function of that ?

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,556
    Yes, but compare against date(), not now().
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Use Date as Welshgasman advises. Date provides today's Date only. Now provides today's Date and Time which you do not want.

  6. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    Usually The Application once opened stays that way for the day.
    That might be OK if there is only ever one user per day, or as long as the db doesn't barf and has to be closed and re-opened. It's also OK if there's no way to re-load the startup form. There ought to be a date field in some table that gets written to when this happens so that it doesn't happen more than once per day. That's like the difference between sophomore and senior.

    So i have a form called mainmenu that default loads when the application is started put that code on the load function of that
    Or use an AutoExec macro, but if I did that, I'd use it to run code rather than try to figure out how to actually do it with a macro. I don't actually use macros to do much of anything beyond running code.a
    Last edited by Micron; 10-02-2021 at 08:03 PM. Reason: added info
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    @rshaw63

    What email product do you use?
    If you open your application on Monday and the renewal date was the Sunday(yesterday) or a holiday your equal will not work.

    In general you will need some logic to determine if the renewal date is <= Date and some flag to say renewal Sent for this Year Yes or No. It would also seem that a query at startup to identify those People/Companies whose renewal date is <= Date and flag renewal Sent = No would be a good start. It the query has >0 hits, then you'll need code to process/send emails to that list.
    As micron said, most will use vba/code rather than macros.

    There are several articles re Sending Emails from Access. Here google will be your friend.
    There is an email related link that may also help with options. Also see the Similar Threads at the bottom of that linked page.

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

Similar Threads

  1. How can I make this work schedule in Access???
    By JoeJr in forum Database Design
    Replies: 8
    Last Post: 10-21-2019, 01:25 PM
  2. Can't make a Dlookup work - please help !
    By mermaidboy in forum Access
    Replies: 3
    Last Post: 11-24-2017, 12:54 AM
  3. Code To make ComboBx work together
    By DATADUDE28 in forum Forms
    Replies: 5
    Last Post: 07-03-2014, 10:29 AM
  4. How do I make this super query work
    By SemiAuto40 in forum Queries
    Replies: 5
    Last Post: 04-04-2012, 09:55 AM
  5. make Add Record button work
    By janjan_376 in forum Forms
    Replies: 3
    Last Post: 06-05-2009, 04:22 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