Results 1 to 5 of 5
  1. #1
    CHEECO is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    156

    RETRiEVE ONLY TODAYS APPOINTMENTS

    Hello everyone



    What I am trying to do is a an appointment reminder retrieve daily appointment, not all appointments for the year. The below is the code I am using. As it is it retrieves all appointment on the yearly calendar. Thank-you Ishould mention that I am using Access 2016.


    Code:
    Private Sub Form_Load()
    'On Load of the switchboard check Jobs table for any uncompleted jobs
    Dim intStore As Integer
    'Count of uncomplete jobs that are past the Expected Completion Date
    intStore = DCount("[ApptID]", "[tblAppointments]", "[ApptStart] <=now() AND [Complete] =0")
    'If count of uncomplete jobs is zero display switchboard
    'Else display message box detailing amount of jobs
    'and give the user the option as to whether to view these or not.
        If intStore = 0 Then
                Exit Sub
                    Else
                        If MsgBox("There are " & intStore & " uncompleted jobs" & _
                        vbCrLf & vbCrLf & "Would you like to see these now?", _
                        vbYesNo, "You Have Uncomplete Jobs...") = vbYes Then
                        DoCmd.Minimize
                        DoCmd.OpenForm "frmReminders", acNormal
                    Else
                Exit Sub
            End If
        End If
    End Sub

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    which line of your code is retrieving all appointments for the year?

    do you mean counting?

  3. #3
    CHEECO is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2016
    Posts
    156
    I believe it is this line. The [ApptStart] is the date of the appointment in the table. The next part of the code "<=now()" I believe is what calls the date to the appointment reminder. I changed the "Now" to "Date" and it did not work.

    intStore = DCount("[ApptID]", "[tblAppointments]", "[ApptStart] <=now() AND [Complete] =0")

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    I think the problem is here:

    DoCmd.OpenForm "frmReminders", acNormal

    What is the record source for the form? If you only want to see "today's" appointments, then you will have to filter the displayed records on the Docmd.openform statement, or base the form on a query which shows only the records for the current date.

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    if you want todays appointments

    "datepart('yyyy',[ApptStart])=date()

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

Similar Threads

  1. Access appointments to Outlook
    By IdleJack in forum Programming
    Replies: 8
    Last Post: 08-16-2019, 04:46 PM
  2. t to todays date
    By Ekhart in forum Forms
    Replies: 4
    Last Post: 07-26-2016, 10:59 PM
  3. Replies: 3
    Last Post: 06-13-2014, 09:16 PM
  4. scheduling appointments
    By mikejames in forum Programming
    Replies: 1
    Last Post: 09-30-2011, 04:45 PM
  5. Calculating Max appointments
    By ET123 in forum Access
    Replies: 2
    Last Post: 07-24-2010, 07:32 AM

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