How have reminder appear on database startup if certain criteria exists

I have a table named tblTasks.  in that table is a date field named ReminderDate.  When the database is opened I would like some kind of message box to appear for every task that has the ReminderDate equal to today's date.

How can I do this?
SteveL13Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Eric ShermanAccountant/DeveloperCommented:
Do you want it for the first user or each time the db starts up?

ET
SteveL13Author Commented:
Each time the database starts up but I forgot to mention that there is also a field in the table named TaskComplete (yes/no field).  So if that field is true then no message for that task.  But if that field is false, then a message for each task due that date (today).
Anders Ebro (Microsoft MVP)Microsoft DeveloperCommented:
Well here is how I do it. I have a form that can display the tasks, and then I simply do a dCount to check if there are any. It looks kinda like this (Some edits made for clarity):
Public Function CheckTasks()
   Dim lngCount As Long
   lngCount = DCount("*", "qryTasks", "ID_User=" & UserID & " AND dtReminder<=Date() AND TaskComplete=False)
   If lngCount > 0 Then
      If vbYes = MsgBox("You have [" & lngCount & "] tasks waiting for your attention" & vbNewLine & _
            "Would you like to view them now?", vbYesNo + vbQuestion, strProjectName) Then
         DoCmd.OpenForm "frm_PendingTasks"
      End If
   Else
   End If
End Function

Note that I do dtReminder<=Date, since I figure if I miss a days work, the system should show me the tasks I missed for yesterday as well.

You can call this function with either an autoexec macro, or from a startup/main form you might have.

Hope that helps.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

Eric ShermanAccountant/DeveloperCommented:
There are several ways to accomplish your request ... Try this one for starters.  This approach will use a small continuous Form Object say we call it frmTasksDue.  

1.) Create frmTasksDue and make the Record Source for this from be a query (SELECT * FROM tblTasks WHERE ReminderDate = #" & Date() & "# AND TaskComplete = True;)

2.) On the Open Event of your Main Form for the db you will need to test and see if any records match the criteria before opening the form.

If Nz(DCount("ReminderDate", "tblTasks", "[ReminderDate] = #" & Date() & "# AND [TaskComplete] = True),0) > 0  Then
     DoCmd.OpenForm "frmTaskDue"
End If

ET
Eric ShermanAccountant/DeveloperCommented:
Also, using my suggestion you would open the frmTaskDue in Dialog mode as shown below.

DoCmd.OpenForm "frmTaskDue", acNormal, , , , acDialog


ET
SteveL13Author Commented:
I'm getting an error on this line:

If Nz(DCount("ReminderDate", "tblTasks", "[ReminderDate] = #" & Date() & "# AND [TaskComplete] = True),0) > 0  Then

Expected list separator or )
Eric ShermanAccountant/DeveloperCommented:
Try this ...

If Nz(DCount("ReminderDate", "tblTasks", "[ReminderDate] = #" & Date() & "# AND [TaskComplete] = True"),0) > 0  Then

Needed double quotes after True to close the criteria section.

ET
Jeffrey CoachmanMIS LiasonCommented:
Please remember that with any automatically recurring code, ...
That you have to consider the contingency when a day is "skipped".

For example, a work Holiday, or dates that trigger on a weekend.
...or any reason that the DB is not opened every single day... (power outages, ..etc)
Eric ShermanAccountant/DeveloperCommented:
Also, the TaskComplete criteria should be = False in both cases not True.  My mistake, sorry for any confusion.

If Nz(DCount("ReminderDate", "tblTasks", "[ReminderDate] = #" & Date() & "# AND [TaskComplete] = False"),0) > 0  Then

Create frmTasksDue and make the Record Source for this from be a query (SELECT * FROM tblTasks WHERE ReminderDate = #" & Date() & "# AND TaskComplete = False;)

ET
Dale FyeOwner, Developing Solutions LLCCommented:
I agree with the idea of using a form for this, although I would probably use a listbox to actually display the data.  So I would create and save a query (qry_frm_TasksDue) with SQL

SELECT TaskID, TaskName, ReminderDate
FROM tblTasks
WHERE [ReminderDate] <= Date()
AND NZ([TaskComplete], 0) = 0

Then, when your application starts (I would put it somewhere in the LOAD event of frmSplash), I would check this query and if it has records, then I would open frm_TasksDue, something like:

IF DCOUNT("*", "qry_frm_TasksDue") > 0 then
    docmd.OpenForm "frm_TAsksDue",,,,,acDialog
End If

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.