MS Access Calendar open form from Day Block

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

    MS Access Calendar open form from Day Block

    I am using the MS Calendar found on this site with Access 2013 on Windows 8.



    I am working on adding a form that opens from a day block on the calendar.

    The date is in the sub form.

    I tried using these

    Code:
        DoCmd.OpenForm "Forms![MainScheduleCourses]![SubScheduleCourses]", , , "[SessionDate] = #" & _
                          CDate(Me![txtDayBlock05].Tag) & "#"
    Code:
        DoCmd.OpenForm "MainScheduleCourses", , , "Forms![MainScheduleCourses]![SubScheduleCourses].Form.[SessionDate] = #" & _
                          CDate(Me![txtDayBlock05].Tag) & "#"
    I tried a few other combos as well.

    I couldn't get it to work.

    Is this possible?

    Kisses are waiting for you on this one ADezii.
    Last edited by NeoPa; Jan 3 '14, 12:22 AM. Reason: Tidied code blocks - no change to code.
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    You are already Opening the MainScheduleCou rses Form from the Dbl-Click() Event of frmCalendar. Assuming you have the proper Parent/Child Linkage between MainScheduleCou rses and the SubScheduleCour ses Sub-Form, there should be no further interaction on your part as regards the Sub-Form. Kindly explain what 'Opening the Sub-Form means'.

    Comment

    • RockKandee
      New Member
      • Dec 2013
      • 89

      #3
      When I use the code from the other thread using just the name of the main form and change [Start Date] to [SessionDate] then

      I get a pop up box: enter parameter value - SessionDate.

      When I click ok to the message box, then the form opens, but opens on a new record.

      When I leave [Start Date] in the code I get the same error, which makes sense because start date isn't on the form. So it seemed likely to me that the code can not find SessionDate.

      I was guessing this was due to [SessionDate] being in the sub form and that I needed to somehow refer to the subform + [SessionDate].

      So I tried several ways including the code I posted above.

      The parent/child link is proper as far as I can tell.

      'Opening the Sub-Form means' - where did I post this at? I couldn't find it. Not sure what it means.

      Thanks for your help.

      Comment

      • NeoPa
        Recognized Expert Moderator MVP
        • Oct 2006
        • 32653

        #4
        RockKandee
        "'Opening the Sub-Form means' - where did I post this at? I couldn't find it. Not sure what it means."

        If you look at your first block of code you are using DoCmd.OpenForm and passing, as the FormName parameter, a reference to "Forms![MainScheduleCou rses]![SubScheduleCour ses]".

        This is a string value which surely has a different meaning than you intended. If you'd used Forms![MainScheduleCou rses]![SubScheduleCour ses]!Name then you would have had a valid reference to the form class of that form you use as a subform. I'm afraid it would still be not what you wanted though. I suspect you want your subform to work as a subform rather than as a main form.

        DoCmd.OpenForm( ) opens main, stand-alone, forms. Subforms are opened automatically when the related main form is opened. They are never added to the Forms collection and cannot be accessed that way (IE. Forms("SubFormN ame") will never work).

        Comment

        • RockKandee
          New Member
          • Dec 2013
          • 89

          #5
          I so wish I knew this weeks ago. I redesigned my entire database to work with this calendar and now my main form won't open with it. I am so sad :(

          Oh well - back to the drawing board.

          Thanks for the explanation, doesn't all sink totally in yet, but I retain pieces here and there.

          Have a great night.

          Comment

          • ADezii
            Recognized Expert Expert
            • Apr 2006
            • 8834

            #6
            RockKandee, before you throw in the towell, are you able to Upload the Database with any sensitive Data removed? There are still some very confusing issues surrounding this Thread that may be able to be resolved by having the DB directly in front of us. At least we will all know exactly what you are referring to by direct observation. Just let us know.

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32653

              #7
              I suspect my last post threw some light over certain matters, but equally suspect that you may have misconstrued a point in there to indicate something you want to do is not possible. That's not how I saw it. I'm thinking that what you want to do is simply done a different way from how you envisage it just now.

              Having a fairly unclear idea of exactly what you're doing leaves me unable to help further at this stage, but like ADezii, I would advise holding on to that towel a while longer.

              To be honest, an attachment with your work as it stands (data sanitised as suggested) combined with an offer from ADezii to assist, is a very strong position to be in. There are few, if any, who understand the concepts of such a database as well as he, and very few so prepared to go that extra mile to help those in need.

              Comment

              • RockKandee
                New Member
                • Dec 2013
                • 89

                #8
                A very generous offer from ADezzi indeed!!

                I wasn't throwing in the towel - just heading back to the drawing board. I was very sad and had been working for 37 hours straight. After some sleep, I have a few ideas running around but need to think them through all the way.

                I need some time to strip down the DB and get it posted - but will do so ASAP.

                Again.....you all rock! but ADezzi gets extra kisses.

                Thanks

                Comment

                • RockKandee
                  New Member
                  • Dec 2013
                  • 89

                  #9
                  Update: I was in the middle of making some huge changes with my database when this offer was made. My changes crashed the whole project. So, I have been busy rebuilding. I now have it back up and running. I have stripped it down as much as possible while still leaving the form I am trying to open and the calendar working.

                  The form - MainCourseSched uling is the form I would like to have open to the matching day block of the calendar.

                  MainCourseSched uling has a continuous sub form.

                  In case the problem was due to the sub form being continuous, I tried to open the form after changing the sub form to a single form. I still get a pop up box: enter parameter value - SessionDate.

                  I have never zipped a file before. Let me know if I messed it up.

                  Thanks again for the help.
                  Attached Files

                  Comment

                  • ADezii
                    Recognized Expert Expert
                    • Apr 2006
                    • 8834

                    #10
                    Was away for a few days with no access to a PC let alone Access. I have the DB now and I'll see what I can do.

                    Comment

                    • ADezii
                      Recognized Expert Expert
                      • Apr 2006
                      • 8834

                      #11
                      You are attempting to Open a Parent Form (MainCourseSche duling) using a Date Criteria ([SessionDate]) that exists exclusively on a Sub-Form (SubCourseSched uling) contained within the Main Form. [SessionDate] cannot be used in the Criteria Argument of the OpenForm() Method since this Method applies to the Parent Form only and [SessionDate] does not exist in its Row Source. That is why you are getting the Error Prompt. What you can do is to create a Query (qrySessions) consisting of all Session Data as well as any related information. Create a Form named 'Session Data' and set its Row Source to this Query. In the Dbl-Click Event of each Day Block (TEXT Box) you can then Open the Session Data Form with Criteria set to the Date that the Block represents. Only those Session dates for the Date Block that you Dbl-Clicked will be displayed in Datasheet View. The Event for each Day Block would be:
                      Code:
                      Private Sub txtDayBlockXX_DblClick(Cancel As Integer)
                       DoCmd.OpenForm "Session Data", acFormDS, , "[SessionDate] = #" & _
                                        CDate(Me![txtDayBlock02].Tag) & "#"
                      End Sub
                      As you can probably guess by now, I have revised your Attachment to display the concept that I have described and uploaded it as RockKandee_2.zi p. Look it over carefully and tell me what you think.

                      P.S. - I am a certified Scuba Diver (PADI) so I can relate to what you are working on.
                      Attached Files

                      Comment

                      • RockKandee
                        New Member
                        • Dec 2013
                        • 89

                        #12
                        Thank you so much for your time ADezii!! Sending kisses your way.

                        Not the news I wanted to hear, but understandable. I am always wanting the impossible. LOL

                        I will adjust my design accordingly, thanks for the example. I will post my results when I am done.

                        I am a PADI girl too and live in a PADI house,but I work for an ex PADI and now SSI gal. Keep on blowing bubbles ;)

                        Comment

                        • ADezii
                          Recognized Expert Expert
                          • Apr 2006
                          • 8834

                          #13
                          Don't do anything drastic yet, I may be able to re-engineer this process for you. Give me a little time.

                          Comment

                          • RockKandee
                            New Member
                            • Dec 2013
                            • 89

                            #14
                            I didn't mean to make it sound drastic.

                            I have an idea of how to do it so it will be easier for the user.
                            Not sure I can explain it clearly just yet, and I don't want to waste your time.

                            Give me some time to finish putting it together and I will post it. I am sure I will run into a glitch of some kind. Then I am gonna need you, and I would rather you not be sick of me by then ;)

                            You are a sweetheart - kisses.

                            Comment

                            • ADezii
                              Recognized Expert Expert
                              • Apr 2006
                              • 8834

                              #15
                              I took a radically different approach to your dilemma. rather than explain in detail what may/may not be what you are looking for, I'll simply Upload the Demo (RockKandee.acc db) and let you decide if this is what you are looking for.
                              Attached Files

                              Comment

                              Working...