Results 1 to 5 of 5
  1. #1
    LoMi97 is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    2

    Send e-mail when membership expires


    Hi,

    I have multiple item form based on query with active users
    http://i.pics.rs/U5fq0

    Query field days left calculates days between today and date when membership expires.
    http://i.pics.rs/gDVdR

    In active users form i have Send e-mail button which sends email to user.
    Code:
    Private Sub command41_click()
    DoCmd.SendObject , , , Me![E-mail], , , "Gym", "Text"
    End Sub
    What i want is that on button click(not send e-mail button from above) or on form load access sends email to every person when days left field value is 0.

    Best regards

  2. #2
    Micron is online now Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    what is this, urls to pictures you want us to look at, or actual code in your project? If the former, best that you post the images here, given what's going on in he world with the latest computer attacks. I for one won't go there. If the latter, it makes no sense to me.
    Quote Originally Posted by LoMi97 View Post
    Hi,

    Code:
    http://i.pics.rs/U5fq0
    Code:
    http://i.pics.rs/gDVdR
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    Make a query to get all users who's membership expired....
    select memID, dateDiff("d",[expDate],Date) as Days from tMembers where dateDiff("d",[expDate],Date) <= 0

    in a form ,put a listbox connected to the above query.
    this will show you all members expired. Now, either set a dbl-click event on the person to SENDOBJECT,
    or
    make a button to scan the list and send an email to each in the list.

  4. #4
    LoMi97 is offline Novice
    Windows 10 Access 2013 32bit
    Join Date
    May 2017
    Posts
    2
    Okay, but how do I scan the list?

  5. #5
    aytee111 is offline Competent At Times
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    This is how you loop through a set of records:

    Code:
    Public Function LoopThruList()
        Dim rst As Recordset
        On Error Resume Next
        Set rst = CurrentDb.OpenRecordset("yourqueryname", dbOpenDynaset)
        rst.MoveFirst
        If Err <> 0 Then
            MsgBox "No records found"
            Exit Function
        End If
        
        Do Until rst.EOF
            DoCmd.SendObject , , , rst![E-mail], , , "Gym", "Text"
            rst.MoveNext
        Loop
        Set rst = Nothing
    End Function

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

Similar Threads

  1. Send e-mail in ACCDE
    By Tom Hovens in forum Modules
    Replies: 0
    Last Post: 03-16-2015, 12:40 AM
  2. Send automatic e-mail
    By Csalge in forum Forms
    Replies: 1
    Last Post: 04-08-2013, 11:33 AM
  3. Replies: 1
    Last Post: 09-14-2012, 10:27 AM
  4. Send E-Mail 2010
    By lrobbo314 in forum Access
    Replies: 6
    Last Post: 03-22-2012, 11:49 AM
  5. send a form via mail
    By Fabdav in forum Forms
    Replies: 1
    Last Post: 10-12-2011, 07:35 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