Link to home
Avatar of SteveL13
SteveL13Flag for United States of America

asked on

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?
Avatar of Eric Sherman
Eric Sherman
Flag of United States of America image

Do you want it for the first user or each time the db starts up?

ET
Avatar of SteveL13

ASKER

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).
SOLUTION
Avatar of Anders Ebro (Microsoft MVP)
Anders Ebro (Microsoft MVP)
Flag of Denmark image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
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
Also, using my suggestion you would open the frmTaskDue in Dialog mode as shown below.

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


ET
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 )
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
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)
SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
ASKER CERTIFIED SOLUTION
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.