VB code to create pop-up reminders for tasks listed in a database that are due RRS feed

  • Question

  • Could you help me to put together the VB code that would enable a pop-up reminder to appear when a user logs on to an Access database, when the task date equates to the current date or is over-due?
    Thursday, January 12, 2017 5:24 PM

All replies

  • Hi TheGodofPleasure,

    you had mentioned that you are using VB.

    so here I assume that you are talking about VB.Net and not about VBA.

    below is an Example.

    I create 1 table named "task" in Access and insert data in to it.

    then I create Windows Application using VB.

    Below is the code.

    Imports System.Data.OleDb
    Public Class Form1
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            ReadData("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Backup 22-11-2016\Database2.mdb", "select * from task")
        End Sub
        Public Sub ReadData(ByVal connectionString As String,
        ByVal queryString As String)
            Using connection As New OleDbConnection(connectionString)
                Dim command As New OleDbCommand(queryString, connection)
                Dim dt, dt1 As Date
                dt = Format(DateTime.Now, "MM/dd/yyyy").ToString
                Dim reader As OleDbDataReader = command.ExecuteReader()
                While reader.Read()
                    dt1 = reader(2).ToString()
                    If (dt1 >= dt) Then
                        Me.TextBox1.Text += "Task:" + reader(1).ToString() + "Date:" + dt1 + vbNewLine
                        MsgBox("Task:" + reader(1).ToString() + "Date:" + dt1 + vbNewLine)
                    End If
                End While
            End Using
        End Sub
    End Class


    when I click on button popup will display and data will also added to textbox.

    it will check all the data in the table.



    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, January 13, 2017 2:02 AM
  • can you give me the source code what you make before?? please
    Monday, July 2, 2018 3:52 AM
  • what if the popup msg have to be shown 7 days before for everydays? any solution?
    Thursday, February 14, 2019 3:29 AM
  • what if the popup msg have to be shown 7 days before for everydays? any solution?

    For future reference, rather than piggy-backing on an old thread, it is preferable to start a new thread and include a hyperlink to any earlier thread to which you wish to refer.

    Taking the OP's table as an example a simple query will return all rows with dates on or later than 7 days after the current date:

    SELECT *
    FROM task
    WHERE t_date >= DATE()+7
    ORDER BY t_date;

    Save the query as qryTasksDue say.  You can then bind a form, frmTasksDue say, to the query and open it conditionally like this:

    If Not IsNull(DLookup("t_id", "qryTasksDue")) Then
        DoCmd.OpenForm "frmTasksDue", WindowMode:=acDialog
    End If

    Ken Sheridan, Stafford, England

    Thursday, February 14, 2019 11:57 AM