MS Access Calendar Stop displaying time

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • RockKandee
    New Member
    • Dec 2013
    • 89

    MS Access Calendar Stop displaying time

    Hi!

    I am using Access 2013 with Windows 8

    I am working with this calendar

    http://http://bytes.com/topic/access...ccess-calendar

    I would like to know if there is a quick way to stop the display of the time with this calendar.

    I already took the long route to accomplish this so there is no need to spend time explaining unless there is a quick and easy route.

    My goal is to easily switch back and forth.

    Thank bunches - Have an Awesome week end.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    1. The displaying of the Date/Time is controlled in the Timer() Event of the CalendarCourses Form, namely:
      Code:
      Private Sub Form_Timer()
      Static lngCounter As Long
      
      lngCounter = lngCounter + 1
      
      Me.Caption = "Calendar Courses (" & Format$(Now(), "dddd - mmmm dd, yyyy hh:mm:ss AM/PM") & ")"
      
      If lngCounter > 2147483000 Then lngCounter = 0
      End Sub
    2. This Timer() Event is activated every Second as indicated by the TimerInterval (1000) Property which is in Milliseconds:
      Code:
      TimerInterval       1000
    3. If you wish to eliminate this Event all together simply set the TimerInterval Property to a Value of 0 which effective disables it:
      Code:
      TimerInterval          0
    4. Any other questions, feel free to ask.

    Comment

    • RockKandee
      New Member
      • Dec 2013
      • 89

      #3
      Oops!

      I meant [start time] not the actual time.

      When I print the calendar, I need the start time to NOT be included due to space limitations.

      My apologies for not being clear.

      Thank you for your help (no kisses for you - the wife gets too jealous - lol)
      Last edited by NeoPa; Jan 25 '14, 11:35 PM. Reason: do -> due.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32633

        #4
        If you pop in the code that displays the start point I should be able to tell you what needs to change Kandee.

        Comment

        • RockKandee
          New Member
          • Dec 2013
          • 89

          #5
          This shows what all I changed to get the start time to not show. The original code is still there.

          Code:
          'Private Function InsertEvent(strExistingText As String, strTitle As String, strStartTime As String)
          Private Function InsertEvent(strExistingText As String, strTitle As String)
                                  '>>>> Kandee - Changed for printing without times
          On Error GoTo Err_InsertEvent
                 'CFB added 2-18-10
                 'Inserts an Event Title & Time into a block's string, sorted by Date (and maybe later, Title)
          
          Dim lngBlockTextLength As Long
          Dim fEventPositionFound As Boolean
          'Dim lngExistingEventTime As Long  'Kandee turned off for printing
          Dim lngExistingEventTitle As Long
          Dim strExistingEvent As String
          'Dim strExistingEventTime As String   'Kandee turned off for printing
          'Dim strEventTime As String  'Kandee turned off for printing
          Dim strEvent As String
          Dim lngEventInsertionPosition As Long
          Dim lngEventPlaceholder As Long
          'Dim lngTimePlaceholder As Long 'Kandee turned off for printing
          Dim lngNewLinePosition As Byte
          
            'strEventTime = Format(strStartTime, "h:mm AMT/PM")   'don't show seconds Kandee trned off for printing
            'strEvent = strTitle & Space(1) & strEventTime      'Kandee changed to a space instead of new line
            strEvent = strTitle      'Kandee changed for printing without time
              
          If strExistingText = "" Then
                InsertEvent = strEvent
          Else
                                                'parse and sort on time & title
            lngBlockTextLength = Len(strExistingText)
            lngNewLinePosition = InStrRev(strExistingText, vbNewLine)
            
                  '>>>>>>>>>>>>>'Kandee turned off for printing
            'strExistingEventTime = Right(strExistingText, lngBlockTextLength - lngNewLinePosition)
              'If strExistingEventTime < strEventTime Then
               ' fEventPositionFound = True
                 'Debug.Print "strExistingEventTime < strEventTime" & " | " & strExistingEventTime & " | " & strEventTime
               '   Debug.Print "*****************************"
                '  Debug.Print strEvent
             ' Else
                      '>>>>>>>>>>>>>>>>>>
                Debug.Print "Else...End If Clause activated"
                fEventPositionFound = False
                Do Until fEventPositionFound
                  lngNewLinePosition = InStrRev(strExistingText, vbNewLine)
                  
                  strExistingEvent = Left(strExistingText, 1)
                  'strExistingEventTime = Right(strExistingText, 10)      'Kandee turned off for printing
                Loop
              End If
                InsertEvent = strExistingText & vbNewLine & strEvent
                  fEventPositionFound = True
          'End If     'Kandee turned off for printing
          
          Exit_InsertEvent:
            Exit Function
            
          Err_InsertEvent:
            MsgBox Err.Description, vbExclamation, "Error in InsertEvent()"
            Call LogErrors(Err.Number, Err.Description, "frmCalendar", "InsertEvent() Function", "Called from PopulateCalendar()")
              Resume Exit_InsertEvent
          End Function
          Private Sub PopulateYearListBox()
               'Procedure added 01-25-08 CFB
               'Sets the Year selection list box to a 24 year range, f
               'This procedure has not been thoroughly tested and it will produce a runtime error if
               'you go before BC or after Nov 9999
               'To use it, call it at the end of the PopulateCalendar procedure
          
          Dim intYear As Integer
          Dim intYearCounter As Integer
          Dim strRowSource As String
          
            intYear = objCurrentDate.Year
            Me.cboYear = intYear
          
               'For intYearCounter = 2000 To 2050        'a 51 year, Absolute Range
          For intYearCounter = (intYear - 12) To (intYear + 12)        'a 25 year range
            strRowSource = strRowSource & LTrim(Str(intYearCounter)) & ";"
          Next intYearCounter
            'strRowSource = strRowSource & LTrim(str(intYearCounter))    'the XX year, no semi-colon
            Me.cboYear.RowSource = Left$(strRowSource, Len(strRowSource) - 1)
          End Sub
          Private Sub OpenEventForm(ctlDayBlock As Control)
            DoCmd.OpenForm "frmEvents", , , , , , ctlDayBlock.Tag
          End Sub
          Private Sub cboMonth_AfterUpdate()
          On Error GoTo Err_cboMonth_AfterUpdate
          
          Select Case Me![cboMonth]
            Case "January"
              objCurrentDate.Month = 1
            Case "February"
              objCurrentDate.Month = 2
            Case "March"
              objCurrentDate.Month = 3
            Case "April"
              objCurrentDate.Month = 4
            Case "May"
              objCurrentDate.Month = 5
            Case "June"
              objCurrentDate.Month = 6
            Case "July"
              objCurrentDate.Month = 7
            Case "August"
              objCurrentDate.Month = 8
            Case "September"
              objCurrentDate.Month = 9
            Case "October"
              objCurrentDate.Month = 10
            Case "November"
              objCurrentDate.Month = 11
            Case "December"
              objCurrentDate.Month = 12
            Case Else
          End Select
          PopulateCalendar
          Exit_cboMonth_AfterUpdate:
            Exit Sub
          
          Err_cboMonth_AfterUpdate:
            MsgBox Err.Description, vbExclamation, "Error in cboMonth_AfterUpdate()"
            Resume Exit_cboMonth_AfterUpdate
          End Sub
          
          Private Sub cboYear_AfterUpdate()
            objCurrentDate.Year = Me![cboYear]
            PopulateCalendar
          End Sub
          
          Private Sub cmdNextMonth_Click()
             Me![cboYear] = Null
             Me![cboMonth] = Null
          
             objCurrentDate.Month = objCurrentDate.Month + 1
          If objCurrentDate.Month = 13 Then
            objCurrentDate.Month = 1
            objCurrentDate.Year = objCurrentDate.Year + 1
          End If
            PopulateCalendar
          End Sub
          Private Sub cmdPreviousMonth_Click()
             Me![cboYear] = Null
             Me![cboMonth] = Null
          
             objCurrentDate.Month = objCurrentDate.Month - 1
          If objCurrentDate.Month = 0 Then
            objCurrentDate.Month = 12
            objCurrentDate.Year = objCurrentDate.Year - 1
          End If
          PopulateCalendar
          End Sub
          
          
          
          Private Sub ctrlPrint_Click()
          
          
          '*********Kandee added PRINT COMMANDS************
          
           'DoCmd.PrintOut Application.Printers("HP Deskjet 3050A J611 series (Copy 1)").Orientation = acPRORLandscape
                  ' prints all pages - code received from ADezii on Bytes thread
           'DoCmd.RunCommand acCmdPrintPreview 'opens preview currently creates an error message
           'DoCmd.RunCommand acCmdPrint 'opens page range
          'Forms("CalendarAll").Printer.Orientation = acPRORLandscape
          'DoCmd.PrintOut , 1, 1, acLow, 1, False 'prints only first page of form
          
          '>>>>>>>change pop up to no then print only first page then back to pop up
           DoCmd.OpenForm "CalendarPrint", acDesign
               Forms!CalendarPrint.PopUp = False
           DoCmd.Close acForm, "CalendarPrint", acSaveYes
           DoCmd.OpenForm "CalendarPrint", acNormal
             Forms("CalendarPrint").Printer.Orientation = acPRORLandscape
           DoCmd.PrintOut , 1, 1, acLow, 1, False
           DoCmd.OpenForm "CalendarPrint", acDesign
            Forms!CalendarPrint.PopUp = True
           DoCmd.Close acForm, "CalendarPrint", acSaveYes
           DoCmd.OpenForm "CalendarPrint", acNormal
          
          '****************************************************
          
          End Sub
          
          Private Sub Form_Activate()
            PopulateCalendar
          End Sub
          Private Sub Form_Open(Cancel As Integer)
          
          '>>>>>>>>>>>>KANDEE - Old Code - Multi Calendar Use<<<<<<<<<<<<
          'DoCmd.RunSQL "DELETE tblCalendarAll.* FROM tblCalendarAll"
          
          'DoCmd.RunSQL "INSERT INTO tblCalendarAll ( [Start Date], [End Date], [Start Time], [End Time], [Title] )" & _
          '" SELECT DISTINCTROW qryCourseSchedule.[Start Date], qryCourseSchedule.[End Date]," & _
          '" qryCourseSchedule.[Start Time], qryCourseSchedule.[End Time], qryCourseSchedule.[Title]" & _
          '" FROM qryCourseSchedule"
          
          'DoCmd.RunSQL "INSERT INTO tblCalendarAll ( [Start Date], [End Date], [Start Time], [End Time], [Title] )" & _
          '" SELECT DISTINCTROW TCalendarHolidays.[Start Date], TCalendarHolidays.[End Date]," & _
          '" TCalendarHolidays.[Start Time], TCalendarHolidays.[End Time], TCalendarHolidays.[Title]" & _
          '" FROM TCalendarHolidays"
          
          'DoCmd.RunSQL "INSERT INTO tblCalendarAll ( [Start Date], [End Date], [Start Time], [End Time], [Title] )" & _
          '" SELECT DISTINCTROW TEventSchedule.[Start Date], TEventSchedule.[End Date]," & _
          '" TEventSchedule.[Start Time], TEventSchedule.[End Time], TEventSchedule.[Title]" & _
          '" FROM TEventSchedule"
          '>>>>>>>>>>>>>KANDEE add end<<<<<<<<<<<<<<<<<<<<<<<<<<<
          
          
          On Error GoTo Err_Form_Open
          Dim dtmTodaysDate
          Dim strMsg As String
          
          dtmTodaysDate = Now
          objCurrentDate.Month = Month(dtmTodaysDate)
          objCurrentDate.Year = Year(dtmTodaysDate)
          
          '>>>>>>Kandee added so calendar will populate using popup window<<<<<
          PopulateCalendar
          '>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<
          
          Exit_Form_Open:
            Exit Sub
            
          Err_Form_Open:
            MsgBox Err.Description, vbExclamation, "Error in Form_Open()"
            Resume Exit_Form_Open
          End Sub
          Private Sub PopulateCalendar()
          On Error GoTo Err_PopulateCalendar
          Dim strFirstOfMonth As String, bytFirstWeekdayOfMonth As Byte, bytBlockCounter As Byte
          Dim bytBlockDayOfMonth As Byte, lngBlockDate As Long, ctlDayBlock As TextBox
          Dim bytDaysInMonth As Byte, bytEventDayOfMonth As Byte, lngFirstOfMonth As Long
          Dim lngLastOfMonth As Long, lngFirstOfNextMonth As Long, lngLastOfPreviousMonth As Long
          Dim lngEventDate As Long, bytBlankBlocksBefore As Byte, bytBlankBlocksAfter As Byte
          Dim astrCalendarBlocks(1 To 42) As String, db As DAO.Database, rstEvents As DAO.Recordset
          Dim strEvent As String
          Dim lngSystemDate As Long   'CFB added 1-25-08
          Dim ctlSystemDateBlock As TextBox, blnSystemDateIsShown As Boolean  'CFB added 1-25-08
          Dim strSQL As String        'Added 4/16/2008
          Dim lngFirstDateInRange As Long     'CFB added 2-18-10
          Dim lngLastDateInRange As Long      '
          Dim lngEachDateInRange As Long      '
          'Dim strStartTime As String          ''Kandee turned off for printing
          
          lngSystemDate = Date        'CFB added 1-25-08
          intMonth = objCurrentDate.Month
          intYear = objCurrentDate.Year
          lstEvents.Visible = False
          labelEventsOnDate.Visible = False
          labelMonth.Caption = MonthAndYear(intMonth, intYear)
          strFirstOfMonth = Str(intMonth) & "/1/" & Str(intYear)
          
          '*************************************************************************
            'ADezii
            'NOTE: Will work in the UK (United Kingdom) and other European Nations
            'strFirstOfMonth = "1/" & Str(intMonth) & Str(intYear)
            'strFirstOfMonth = "1/" & Str(intMonth) & "/" & Str(intYear) ' Kandee - found this on Bytes thread PPelle added "/"
          '*************************************************************************
           
           
          '>>>>>>>>>>>>>>>>>>>>>>>>> START DAY OF WEEK <<<<<<<<<<<<<<<<<<<<<<<
          ' Kandee - turn on for Monday start week - turn off for Sunday start week - found this on Bytes thread -PPelle added vbMonday
          'bytFirstWeekdayOfMonth = Weekday(strFirstOfMonth, vbMonday)
          'Kandee - turn this off for Monday week start or on for Sunday week start
          bytFirstWeekdayOfMonth = Weekday(strFirstOfMonth)
          '>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<
          
          lngFirstOfMonth = DateSerial(intYear, intMonth, 1)
          lngFirstOfNextMonth = DateSerial(intYear, intMonth + 1, 1)
          lngLastOfMonth = lngFirstOfNextMonth - 1
          lngLastOfPreviousMonth = lngFirstOfMonth - 1
          bytDaysInMonth = lngFirstOfNextMonth - lngFirstOfMonth
          bytBlankBlocksBefore = bytFirstWeekdayOfMonth - 1
          bytBlankBlocksAfter = 42 - (bytBlankBlocksBefore + bytDaysInMonth)
              
          Set db = CurrentDb
          
          
                     'CFB added 2-18-10
          '<<<<<<<<<<<<<<<Substitute your own SQL Statement here>>>>>>>>>>>>>>>
          strSQL = "Select qryCourseSchedule.Title, qryCourseSchedule.[Start Date], qryCourseSchedule.[End Date], " & _
                   "qryCourseSchedule.[Start Time] From qryCourseSchedule Where qryCourseSchedule.[Start Date] " & _
                   "Between " & lngFirstOfMonth & " And " & lngLastOfMonth & _
                   " or qryCourseSchedule.[End Date] Between " & lngFirstOfMonth & " And " & lngLastOfMonth & _
                   " or (qryCourseSchedule.[Start Date] < " & lngFirstOfMonth & _
                   " and qryCourseSchedule.[End Date] > " & lngLastOfMonth & ")" & _
                   " ORDER BY qryCourseSchedule.[Start Time], " & _
                   "qryCourseSchedule.[Start Date], qryCourseSchedule.[Title];"
          '<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
                   
                   
          Set rstEvents = db.OpenRecordset(strSQL)    'Added 4/16/2008
          
          Do While Not rstEvents.EOF
                                                   'CFB added 2-18-10
            lngFirstDateInRange = rstEvents![Start Date]      '<Substitute for [Start Date]>
            If lngFirstDateInRange < lngFirstOfMonth Then
            lngFirstDateInRange = lngFirstOfMonth
            End If
            lngLastDateInRange = rstEvents![End Date]         '<Substitute for [End Date]>
            If lngLastDateInRange > lngLastOfMonth Then
              lngLastDateInRange = lngLastOfMonth
            End If
            
            For lngEachDateInRange = lngFirstDateInRange To lngLastDateInRange
              bytEventDayOfMonth = (lngEachDateInRange - lngLastOfPreviousMonth)
              bytBlockCounter = bytEventDayOfMonth + bytBlankBlocksBefore
               ' If IsNull(rstEvents![Start Time]) Then        '<Substitute for [Start Time]>  'Kandee turned off for printing
                 ' strStartTime = ""
               ' Else   'Kandee turned off for printing
                  
                  
               '**********************CHOOSE TIME FORMAT**********************
                  
                  'strStartTime = Format$(rstEvents![Start Time], "Short Time")       'Military Time <Substitute for [Start Time]>
                  'strStartTime = Format$(rstEvents![Start Time], "h:mm AM/PM")        '<Substitute for [Start Time]>
                              'Kandee turned off for printing
                  '**********************************************************
                  
                  
               ' End If       'Kandee turned off for printing
                                                        '<Substitute for [Title]>
                                    'Kandee's modified code - removed new line and replaced with a space
                If astrCalendarBlocks(bytBlockCounter) = "" Then
                  'astrCalendarBlocks(bytBlockCounter) = rstEvents![Title] & Space(1) & strStartTime
                                                                                  'Kandee turned off for printing
                  astrCalendarBlocks(bytBlockCounter) = rstEvents![Title]
                  
                Else                                    '<Substitute for [Title]>
                  astrCalendarBlocks(bytBlockCounter) = astrCalendarBlocks(bytBlockCounter) & vbNewLine & _
                                                        rstEvents![Title] '& Space(1) & strStartTime  'Kandee turned off for printing
          Blows kisses to NeoPa

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            I do believe that you are over complicating the matter. Give the following a try then get back to us.
            1. Set the Orientation of the Application Printer to Landscape.
            2. Temporarily disable the Timer by setting the TimerInterval Property to 0.
            3. Temporarily change the Caption of the Calendar Form so that it does not display the Time but just Calendar Courses along with the Day and Date.
            4. Select the Current Record so that only the Current Calendar Display that you are looking at will print.
            5. Print the Selection.
            6. Reset the TimerInterval to 1000 (1 sec) to return to normal display with the Time.
              Code:
              Application.Printer.Orientation = acPRORLandscape
              
              With Me
                .TimerInterval = 0
                .Caption = "Calendar Courses (" & Format$(Now(), "dddd - mmmm dd,yyyy") & ")"
                   DoCmd.RunCommand acCmdSelectRecord
                   DoCmd.RunCommand acCmdPrintSelection
                .TimerInterval = 1000
              End With
            7. Let us know how you make out.

            Comment

            • RockKandee
              New Member
              • Dec 2013
              • 89

              #7
              I didn't actually try the code you provided, I just changed the code manually. I can't print for a couple of days, so I could only test by viewing. However, those changes only made the time in the form's caption go away.

              Maybe it only works for printing and not viewing?

              I need the [Start Time] that displays with the [Title] in each day block to not show.

              Code:
              'Private Function InsertEvent(strExistingText As String, strTitle As String, strStartTime As String)
              Private Function InsertEvent(strExistingText As String, strTitle As String)
              That's why I changed the string.

              Thanks ADezii - smooches
              Last edited by RockKandee; Jan 26 '14, 04:32 AM. Reason: bracket placement fix

              Comment

              • ADezii
                Recognized Expert Expert
                • Apr 2006
                • 8834

                #8
                I need the [Start Time] that displays with the [Title] in each day block to not show
                To the best of my knowledge, this cannot be done unless you repopulate the Calendar eliminating the Start Time Element from each Day Block, then Print it.

                Comment

                • RockKandee
                  New Member
                  • Dec 2013
                  • 89

                  #9
                  Ok - Keeping my separate printable version is what I will do.

                  Thank you!

                  Comment

                  • ADezii
                    Recognized Expert Expert
                    • Apr 2006
                    • 8834

                    #10
                    I do believe that I may have arrived at a viable solution. It is a little complicated and convoluted so I will not go into the Logic until you have a look at it and see if it is what you want. The Code basically strips the Time Component out of each Day Block prior to actually Printing the Form. Since each Day Block is not 'Bound', has no Control Source, this action has no appreciable effect other than appearance. As soon as you move off the Current Month, the original Time Components are restored to the Day Blocks. In any event:
                    1. Extract the Database from the Zip File I am sending you.
                    2. Open the Database.
                    3. Navigate to December 2013.
                    4. Click on the Click Me RockKandee Command Button in the upper left hand corner of the Form.
                    5. Notice that all of the Times only have been removed from the Day Block Displays.
                    6. Move off December 2013 and the Normal Display will again be restored.
                    7. Good luck and let us know how you make out.
                    Attached Files

                    Comment

                    • NeoPa
                      Recognized Expert Moderator MVP
                      • Oct 2006
                      • 32633

                      #11
                      When I asked for the code that printed the [Start Time] Kandee, that was all I wanted.

                      The whole module leaves me having to interpret what everything does before I can even start looking at the code in question. I'm not as familiar with the whole database as ADezii is.

                      If you can show just the relevant code I'll see what I can do for you. From ADezii's replies already though, I guess it may be somewhat more complicated than I would have expected. I'm happy to look though.

                      Comment

                      • RockKandee
                        New Member
                        • Dec 2013
                        • 89

                        #12
                        ADezii is a Rock Star.

                        It looks perfect. I am at home and out of ink - lol. I will test the printing on Tuesday and let you know. Thank you so much.

                        NeoPa

                        That isn't the whole module it is only part of it. I copied from the first mention of [Start Time] through to the last mention. I do not know which parts print the start time. I think it prints simply because it is displayed on the form. I am not sure which parts of the code need to be removed in order for the display to stop. That's why I changed all of the parts in the above posted code. Cuz I don't know what I am doing :S

                        But thank you very much for the offer :D

                        Comment

                        • ADezii
                          Recognized Expert Expert
                          • Apr 2006
                          • 8834

                          #13
                          Just wanted to mention that I see a reference to the InsertEvent() Function, namely:
                          Code:
                          Private Function InsertEvent(strExistingText As String, strTitle As String, strStartTime As String)
                          'Code intentionally omitted
                          End Function
                          This is a legacy Function that was to be integrated into the Access Calendar by the Original Author many years ago, but never was. It would have been called from the PopulateCalenda r() Sub-Routine when Data was written to each of the Day Blocks. After taking over the DB I simply left it in tact (partially completed) in an attempt to maintain as much of the Legacy Code as possible. It serves no real purpose in the Calendar Database.

                          Comment

                          • NeoPa
                            Recognized Expert Moderator MVP
                            • Oct 2006
                            • 32633

                            #14
                            Fair enough Kandee :-)

                            Comment

                            • ADezii
                              Recognized Expert Expert
                              • Apr 2006
                              • 8834

                              #15
                              After much thought, RockKandee, there is actually another approach that can resolve your dilemma and it involves the use of a Conditional Compilation Constant. Simply setting the Value of this Constant to True includes Start Time in the Day Blocks of the Calendar while False does not include it. Refer to Code Lines: 2, 4-21, 39-45, 48-52, and 54-60.
                              Code:
                              '************************************** CODE INTENTIONALLY OMITTED **************************************
                              #Const IncludeStartTime = True
                              
                              #If IncludeStartTime Then
                                strSQL = "Select QCourseSchedule.Title, QCourseSchedule.[Start Date], QCourseSchedule.[End Date], " & _
                                  "QCourseSchedule.[Start Time] From QCourseSchedule Where QCourseSchedule.[Start Date] " & _
                                  "Between " & lngFirstOfMonth & " And " & lngLastOfMonth & _
                                  " or QCourseSchedule.[End Date] Between " & lngFirstOfMonth & " And " & lngLastOfMonth & _
                                  " or (QCourseSchedule.[Start Date] < " & lngFirstOfMonth & _
                                  " and QCourseSchedule.[End Date] > " & lngLastOfMonth & ")" & _
                                  " ORDER BY QCourseSchedule.[Start Time], " & _
                                  "QCourseSchedule.[Start Date], QCourseSchedule.[Title];"
                              #Else
                                strSQL = "Select QCourseSchedule.Title, QCourseSchedule.[Start Date], QCourseSchedule.[End Date] " & _
                                  "From QCourseSchedule Where QCourseSchedule.[Start Date] " & _
                                  "Between " & lngFirstOfMonth & " And " & lngLastOfMonth & _
                                  " or QCourseSchedule.[End Date] Between " & lngFirstOfMonth & " And " & lngLastOfMonth & _
                                  " or (QCourseSchedule.[Start Date] < " & lngFirstOfMonth & _
                                  " and QCourseSchedule.[End Date] > " & lngLastOfMonth & ")" & _
                                  " ORDER BY QCourseSchedule.[Start Date], QCourseSchedule.[Title];"
                              #End If
                              
                              Set rstEvents = db.OpenRecordset(strSQL)    'Added 4/16/2008
                              
                              Do While Not rstEvents.EOF
                                'CFB added 2-18-10
                                lngFirstDateInRange = rstEvents![Start Date]      '<Substitute for [Start Date]>
                                If lngFirstDateInRange < lngFirstOfMonth Then
                                lngFirstDateInRange = lngFirstOfMonth
                                End If
                                lngLastDateInRange = rstEvents![End Date]         '<Substitute for [End Date]>
                                If lngLastDateInRange > lngLastOfMonth Then
                                  lngLastDateInRange = lngLastOfMonth
                                End If
                                
                                For lngEachDateInRange = lngFirstDateInRange To lngLastDateInRange
                                  bytEventDayOfMonth = (lngEachDateInRange - lngLastOfPreviousMonth)
                                  bytBlockCounter = bytEventDayOfMonth + bytBlankBlocksBefore
                                    #If IncludeStartTime Then
                                       If IsNull(rstEvents![Start Time]) Then        '<Substitute for [Start Time]>
                                         strStartTime = ""
                                       Else
                                         strStartTime = Format$(rstEvents![Start Time], "h:mm AM/PM")       '<Substitute for [Start Time]>
                                       End If
                                    #End If
                                                                            '<Substitute for [Title]>
                                    If astrCalendarBlocks(bytBlockCounter) = "" Then
                                      #If IncludeStartTime Then
                                        astrCalendarBlocks(bytBlockCounter) = rstEvents![Title] & Space(1) & strStartTime
                                      #Else
                                        astrCalendarBlocks(bytBlockCounter) = rstEvents![Title]
                                      #End If
                                    Else
                                      #If IncludeStartTime Then
                                        astrCalendarBlocks(bytBlockCounter) = astrCalendarBlocks(bytBlockCounter) & vbNewLine & _
                                                                              rstEvents![Title] & Space(1) & strStartTime
                                      #Else
                                        astrCalendarBlocks(bytBlockCounter) = astrCalendarBlocks(bytBlockCounter) & vbNewLine & _
                                                                              rstEvents![Title]
                                      #End If
                                    End If
                                Next lngEachDateInRange
                                '************************************** CODE INTENTIONALLY OMITTED **************************************
                              P.S. - The Code may not be Optimized since I simply threw it together on a whim.

                              Comment

                              Working...