MS Access Calendar

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • scootaman
    New Member
    • Feb 2010
    • 22

    Here is the file

    I would like the event title and the start time to show in the calendar.

    Thanks for your help!!!!!
    Attached Files

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      Sorry, but I am not runningt Access 2007. Can you convert this DB to Access 2003 Format? If you cannot, I'll simply duplicate the Table Structure, but this would simply prolong the process.

      Comment

      • scootaman
        New Member
        • Feb 2010
        • 22

        Saved as 2002-2003

        Here it is. I had to change the attachment feild to text type in order to get it to convert, but I don't think that should effect anything.


        Thanks.
        Attached Files

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          See how this (Attachment) works out for you:
          Attached Files

          Comment

          • scootaman
            New Member
            • Feb 2010
            • 22

            ADezii,

            Wow Great Form!! Thanks for help on this! I think I have it working, I had to delete the attachemnt field from both tables in my 2007 database. the calendar form would not work or populate with the attachment field for some reason when the property was set to the new 2007 attachment property. I made sure both fields were set to the attachment property, but that didn't make a difference. Once I deleted that field, the form opened up fine. I also had found that when I tried to create a macro button to open then form in dialog mode from my main Training Event form, that the calender would open blank and I had to switch to the month from the drop down list or click the Sync Up botton. It has something to do with the dialog mode. In normal mode it opens to the correct month but I lose all my top row of buttons. I have solved this for now by copying the code from the Sync Up button and copying it to the On Load event. Now the form opens in Dialog mode and populates the calendar with the current month. I hope this is the right fix for opening the form.

            Thanks for your help

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              You are quite welcome. There is a Bug in the code relating to the display of the Start Date within the Events List Box at the bottom of the Calendar Form. Should an Event span multiple days, the Start Date in the List Box will reflect the actual Date selected in the Calendar itself, and not the True Start Date. I'll try to correct it this evening, then Upload the amended Database as an Attachment. I would hold off incorporating the Calendar into your DB until I get this fixed. It involves changes in a couple of Procedures, modifying at least 1 Property of the Events List Box, and adding an additional Field to the TEMP Table. Stay tuned...

              P.S. - Because of the logic used in this Database, namely the constant Deletion and Appending of Records to an Intermediate Table, I would periodically Compact the DB.

              Comment

              • scootaman
                New Member
                • Feb 2010
                • 22

                ADezii

                I looked at the multiple date span and how it shows is fine with me since the end date stays the same. It doesn't cause me any confusion since the dates all show in the calendar. So you don't need to worry about fixing that for me.
                I do have the calendar in my database and it is working fine and I really like it.

                I do have one question that I am not sure if it can be done. I set the double click property to:
                DoCmd.OpenForm "Training Events Details", acNormal, , , acFormAdd, acDialog

                Is there way to insert the date of the day that is double clicked into the date field as the form is opened?

                Comment

                • ADezii
                  Recognized Expert Expert
                  • Apr 2006
                  • 8834

                  Yes there is. I am heading to work right now, but I will try to get to it this evening and Post just the additional code (Single Line) here.

                  Comment

                  • ADezii
                    Recognized Expert Expert
                    • Apr 2006
                    • 8834

                    It's not exactly intuitive, but the actual Date Value of the Calendar Block (Text Box) Dbl-Clicked on can be retrieved via the Blocks’ Tag Property then passed as an Argument to the OpenForm() Method. In the Current() Event of Training Events Details, a Date Field can then be populated with this Value.
                    1. In the Dbl-Click() Event of 'ALL' 42 Text Boxes, Copy-N-Paste the following Line of Code substituting each Block's Name. I'll use the 4th Text Box for an example:
                      Code:
                      Private Sub txtDayBlock04_DblClick(Cancel As Integer)
                        DoCmd.OpenForm "Training Events Details", acNormal, , , acFormAdd, acDialog, CDate(Me![txtDayBlock04].Tag)
                      End Sub
                    2. In the Current() Event of the Training Events Details Form Copy-N-Paste the following Line of Code:
                      Code:
                      Private Sub Form_Current()
                        If Me.NewRecord Then
                          Me![<Date Field Name>] = Me.OpenArgs
                        End If
                      End Sub
                    3. Any further questions, feel free to ask.

                    Comment

                    • scootaman
                      New Member
                      • Feb 2010
                      • 22

                      That worked! The only thing I need to do is figure out a good way to prevent numerous records with just a start date from building up if someone double clicks on a few different dates on the calendar and decided not to enter an event. I fixed that problem for now by running a deleted query on close that will delete all records without a title. I'm sure there is a better way but that was the only way I could figure to keep numerous unwanted records from being entered.

                      If I new I was the only one who was going to use this database, I wouldn't worry about it and just delete the few times I might accidentally insert an erroneous record. However, I am collaborating with the State which is interested in my project and has asked to share it with others in our State. For this reason I am trying to make it user friendly for someone who may have very little Access experience. I am just a few steps above a novice and I am very thankful for forums like this where one can find so much help!

                      Comment

                      • ADezii
                        Recognized Expert Expert
                        • Apr 2006
                        • 8834

                        The only thing I need to do is figure out a good way to prevent numerous records with just a start date from building up if someone double clicks on a few different dates on the calendar and decided not to enter an event.
                        1. Make one or more Fields Required - the User will not be able to Save the Record without enter Data into this/these Fields.
                        2. Validation Code in the BeforeUpdate() Event of the Form, seating the Cancel Argument to True when necessary.

                        Comment

                        • scootaman
                          New Member
                          • Feb 2010
                          • 22

                          Originally posted by ADezii
                          1. Make one or more Fields Required - the User will not be able to Save the Record without enter Data into this/these Fields.
                          2. Validation Code in the BeforeUpdate() Event of the Form, seating the Cancel Argument to True when necessary.
                          What is the code that would go in the BeforeUpdate() Event?

                          My Title field was origninally required but I found that it created a error message on close that made it very difficult to close the form. The error just kept looping back. Will step two prevent all the warning messages?

                          I turn the warnings off then back on with the delete query so that no messeges show.

                          Thanks

                          Comment

                          • scootaman
                            New Member
                            • Feb 2010
                            • 22

                            Originally posted by ADezii
                            1. Make one or more Fields Required - the User will not be able to Save the Record without enter Data into this/these Fields.
                            2. Validation Code in the BeforeUpdate() Event of the Form, seating the Cancel Argument to True when necessary.
                            I found the following code on the web that seems to work on close. It gives the user the choice to go back to the form or cancel the record. I went back and set my Title field to required and this code worked fine for closing the form without saving the record.
                            Code:
                            If IsNull(Me![Title]) Then
                                    If MsgBox("'Title' must contain a value." & Chr(13) & Chr(10) & _
                                    "Press 'OK' to return and enter a value." & Chr(13) & Chr(10) & _
                                    "Press 'Cancel' to abort the record.", _
                                    vbOKCancel, "A Required field is Null") = vbCancel Then
                                         DoCmd.Close
                                         ' For Access 2.0 remove the previous line and replace with:
                                         ' DoCmd Close
                                    Else
                                         Me![Title].SetFocus
                                    End If
                                  Else
                                    DoCmd.Close
                                  End If
                            Last edited by NeoPa; Feb 3 '10, 06:49 PM. Reason: Please use the [CODE] tags provided

                            Comment

                            • scootaman
                              New Member
                              • Feb 2010
                              • 22

                              ADezii

                              Thanks for all your help, I think I have everything going well with the calendar. I have just one question left, (hopefully my last dumb question). Is there a way to generate the Sync Up comand for the calendar when I close the Training Events Detail form?

                              After I double click a calendar date to add an event, enter the info and then close the form, I notice the calendar does not show the new date unless I click the Sync Up button. It's not a big deal to hit the sync button but I thought it would be nice it I could get the calendar to sync up when the Events Detail Form closes. I did try to put the Sync Up code on the Got_Focus and Current Events of the Calendar form, but neither of those worked.

                              Thanks for all your help!!!!!

                              Comment

                              • ADezii
                                Recognized Expert Expert
                                • Apr 2006
                                • 8834

                                In the Close() Event of the Training Details Form:
                                Code:
                                Private Sub Form_Close()
                                'Explicitly Set Focus to the Calendar Form
                                Forms![frmCalendar].SetFocus
                                
                                'Activate the Shortcut Key for the Sync Command Button
                                SendKeys "%S", True
                                End Sub

                                Comment

                                Working...