Results 1 to 5 of 5
  1. #1
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528

    Message Box To Alert That The Expiration Date

    Hello guys
    I need to create a kind of
    Notice the user's notification message when the database or form is opened
    There are records within 30 days of expiration.
    I'm not sure if this Maybe


    thank you

  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,771
    You could have a MsgBox popup or display info in textbox on form.

    DCount("*", "tablename", "[ExpDate] BETWEEN Date() AND Date() + 30")
    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
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you June7
    I used this code to show me an error message
    Code:
    Private Sub Form_Load()
    Dim intContractCount As Integer
    intContractCount = Nz(DCount("ContractID", "Contracts", "Contracts.EndDate<=DateAdd('m',-1,Date()));"), 0)
    If intContractCount > 0 Then
        MsgBox Prompt:="The number of expiring contracts in the next month is " & intContractCount, Buttons:=vbOkayOnly, Title:="Alert"
    End If
    End Sub
    Attached Thumbnails Attached Thumbnails erre.PNG  

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    There is no need for semi-colon, that will error. Paren following the quote mark is extra and that quote is in wrong position.

    Nz(DCount("ContractID", "Contracts", "EndDate<=DateAdd('m',-1,Date())"), 0)


    However, this will likely include records where the EndDate is prior to current date. Do you really want to count history? That's why I used the BETWEEN AND operator.
    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
    azhar2006's Avatar
    azhar2006 is offline Expert
    Windows 7 32bit Access 2010 32bit
    Join Date
    Mar 2012
    Posts
    528
    Thank you so much June7
    This is what I want

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

Similar Threads

  1. Prompt Pop Up Alert Message on clicking Form Button
    By Alexandru Human in forum Forms
    Replies: 2
    Last Post: 09-28-2015, 07:12 PM
  2. Alert or Message Box on Data Change within Query or Table
    By HelpMePlease in forum Programming
    Replies: 5
    Last Post: 04-02-2014, 08:57 AM
  3. Expiration Date
    By nhoover in forum Database Design
    Replies: 5
    Last Post: 03-14-2013, 10:08 PM
  4. Replies: 9
    Last Post: 09-26-2012, 12:20 PM
  5. Alert Message Code Problem
    By 10 Gauge in forum Forms
    Replies: 1
    Last Post: 03-15-2011, 12:17 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