SteveL13
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?
How can I do this?
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
DoCmd.OpenForm "frmTaskDue", acNormal, , , , acDialog
ET
ASKER
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 )
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
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)
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
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ET