Export access form to ppt

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • osmosisgg
    New Member
    • Dec 2013
    • 51

    #31
    The only thing I could find was in 2 subs but don't think this is what you are speaking about. No other DAO.database found except in that first part.

    Sub OnSlideShowPage Change(ByVal SSW As SlideShowWindow ) AND Sub SetupLinkToData base()
    Code:
    Dim zstrDatabaseName As String
    In p.30, I have what I commented out with " ' ", should I go back and not comment them out and remove the MSAccess reference?

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #32
      I tell you what, when I run into things like this near the start of the project I tend to go back to ground zero.

      So, back-up your current PPTM
      Using a copy of your file, go in and delete ALL of your code.
      Don't worry about the action buttons at this point.
      Save and close for now

      Taking the longer path
      Now what I would do is open the PPTM I sent you
      <alt><F11> to open the VBE
      Right click on Module1 and export to a place you can find it
      Right click on clsApplicationE vents and export to the same place.
      Close my PPTM

      Now reopen your PPTM copy
      <alt><F11> to open the VBE
      <ctrl><m> to import clsApplicationE vents FIRST
      <ctrl><m> to import Module1 second.
      Save
      Go back to your slides and check that the action buttons are properly assigned to the VBA subs.
      Save

      Now beacause I am fairly certain that the latebinding will work, leave all of the General/Declaration section alone.


      Go to Sub SetupLinkToData base() and set:
      Code:
      zstrDatabaseName = "Bytes_Thread_954564_ConnectToAccess2010_DB.accdb"
      to your database

      Change your "zstrSQL = " to match what you have

      Go to Sub enterthenewreco rd() and change the control names to match what you have in the slides.

      Menu/Debug/Compile
      Let's make sure that this works first.
      You may have to start the slide show and go forward and back etc as I've mentioned

      (...)
      What I have now learned is that Sub OnSlideShowPage Change(ByVal SSW As SlideShowWindow ) method that I used in 97, and 2000, etc... has been... well... taken out back and shot by Microsoft. It's still there, and it still works; however that is for legacy support and somewhat unreliable.

      So, three workarounds.
      1. use an acction button to initate things.
      2. insert the duplicate first slide
      3. create an add-in


      I started with and tested Tested option 1 with my PPTM:
      I made a copy of Slide1, removed all of the text etc... leaving just the background. Set the transition to none, set the duration to 1 second, set the advance on mouseclick to true, set the advance timer to 0:00.05

      Adjusted the code as follows:
      Add
      Code:
      Public slidecoderan As Integer
      to the top section

      Altered
      Code:
      Sub OnSlideShowPageChange(ByVal SSW As SlideShowWindow)
          Dim zstrCurrentPresentationPath As String
          Dim zstrDatabaseName As String
          Dim zstrFileToOpen As String
          Dim zstrActOnThisFile As String
          '
          Select Case SSW.View.CurrentShowPosition
              Case SSW.Presentation.SlideShowSettings.StartingSlide
                  'just here as place holder
                  'moved all the code from here to Case 2
              Case 2
                  '
                  'I know, boolean, however, the unassigned boolean doesn't trip as either true nor false
                  'found that out the hard way
                  If slidecoderan < 1 Then
                      Set thispresentation = ActivePresentation
                      Set thisslide = thispresentation.Slides.Item(SSW.View.CurrentShowPosition)
                      Set firstslide = thispresentation.Slides.Item(SSW.View.CurrentShowPosition)
                      '
                      'Hide the first shape until things are connected
                      With firstslide.Shapes.Item("z_ab_nextslide")
                          .Visible = False
                          .ShapeStyle = msoShapeStylePreset37
                      End With
                      '
                      'setup the connections.
                      Call InitApplicationEvents
                      Call SetupLinkToDatabase
                      '
                      slidecoderan = 1
                  End If
              Case SSW.Presentation.SlideShowSettings.EndingSlide
                  'for some reason this event is not running?
                  Call cleanuptheobjects
                  MsgBox Prompt:="(...).EndingSlide event triggered", Title:="OnSlideShowPageChange"
              Case Else
                  Set thisslide = thispresentation.Slides.Item(SSW.View.CurrentShowPosition)
                  Set theseshapes = thisslide.Shapes
                  Call cleartherecords
                  Call enterthenewrecord
          End Select
      End Sub
      Then add the following to cleanuptheobjec ts()
      Code:
      If slidecoderan > 0 Then slidecoderan = 0
      otherwise there is a chanc that the slidecoderan will retain the 1 value preventing the code from working should you [Esc] and come back to the presentation without first closing the file.

      This seems to work fairly well and keeps the remaining code intact.

      Using the Action button.
      What I would do here is build on the class module the events that are being handled within the above code and then the action button would basically call Sub InitApplication Events() and code to move to the next slide while the class init code would handle things that the above code handles during startup.
      The add-in, while not hard, is just one more file to make sure is with your presentation...


      (I'll upload this newer changes to replace the former in a little while Post #16 = Bytes_Thread_95 4564_V201402141 451.zip)
      Last edited by zmbd; Feb 14 '14, 08:55 PM.

      Comment

      • osmosisgg
        New Member
        • Dec 2013
        • 51

        #33
        Compiled with no errors. yay!
        (I did not set my reference to MSO 14.0 access db engine object. I will do so if/when you instruct me to do so)

        I followed the instructions. Where exactly did you want me to put the below into the sub cleanuptheobjec ts? After end with?
        Code:
            If slidecoderan > 0 Then slidecoderan = 0
        The slides whiz by and there are no popups at the end for "done" or "goodbye" so they are not being called? In normal view, there is still no data.

        I will await your posting. If I can't stay awake, I will check back tomorrow. :)

        Comment

        • zmbd
          Recognized Expert Moderator Expert
          • Mar 2012
          • 5501

          #34
          ( Post #16 = Bytes_Thread_95 4564_V201402141 451.zip)
          Has all of the changes and the work around.

          ""done" or "goodbye""
          Are message boxes in my posted PPTM so if the code is called they should pop-up.

          You will not see any changes nor connection in "normal" view, only when the slide show is running [F5] will the code work.

          Comment

          • osmosisgg
            New Member
            • Dec 2013
            • 51

            #35
            I can't figure out what I am doing wrong. I only am using your files and the arrow is red the first time around. I have to close out the ppt and re-open since the arrow disappears on the second go around. I must be missing something somewhere. :(

            Comment

            • zmbd
              Recognized Expert Moderator Expert
              • Mar 2012
              • 5501

              #36
              Are you getting an macro warning?
              Are you getting a sandbox/can't be edited warning?
              Open PP w/o any files


              Ribbon>File>Opt ions
              customize ribbons
              Right pane
              Look for "Developer"
              Select this and [OK]
              This will put a tab on PP-Ribbon that will make it easier to get to the VBA

              Go back to the main window, you should see the "Developer" tab in the ribbon, click in:

              "Macro Security"

              THis will open the trust center to the Macro Security level:
              Macro Settings
              I always have this set to "Disable all macros with Notification." Please change to this setting.
              The default is often "Disable all macros without notification"
              I do not use the signed nor enable all. One, because either the macros come from someone I know and trust already; thus, with notification I will enable them and because enabling all without knowing what they do is just crazy talk!

              While we're here let's take a look at:

              Trusted Locations
              Make note of one of the folder paths and locations
              See if you have any "Normal" type locations such as "My Documents"
              - If not, don't add any just yet
              - IF you do, then copy the PPTM and th ACCDB that was in the zip file to the location and open them from there.

              and

              Protected View
              All of these should be checked by default.
              This will force you to explicitly allow editing and other data execution. Just another layer of protection.

              Click OK thru these changes.

              Close and reopen PP (shouldn't be required; however, ... )
              Open the PPTM from the newest zip file
              You should get several popup warnings at this point.
              Make sure you select enable macros and enable editing.

              This is the point where security can be a nessary pain in the rear (^_^)
              Last edited by zmbd; Feb 16 '14, 03:12 PM.

              Comment

              • osmosisgg
                New Member
                • Dec 2013
                • 51

                #37
                No warnings and security settings are in order. I'm going to delete all files and begin again.

                Comment

                • osmosisgg
                  New Member
                  • Dec 2013
                  • 51

                  #38
                  I deleted everything and am wondering if you could please post the file with the data table. Please?

                  Comment

                  • zmbd
                    Recognized Expert Moderator Expert
                    • Mar 2012
                    • 5501

                    #39
                    This file should have it in there:
                    ( Post #16 = Bytes_Thread_95 4564_V201402141 451.zip)

                    Including the duplicate slide workaround and associated code changes.

                    Comment

                    • osmosisgg
                      New Member
                      • Dec 2013
                      • 51

                      #40
                      ok - I tried on 2 different computers, both with access 2010 and I went ahead and tried with access 2013 and to no avail. :(

                      Also the access files only contain the people data and not the data table, but I used the people table field names.

                      Comment

                      • zmbd
                        Recognized Expert Moderator Expert
                        • Mar 2012
                        • 5501

                        #41
                        Then I'm not sure what is happening other than you need to go thru the VBA security settings as I have outlined in Post #36

                        I have downloaded ( Post #16 = Bytes_Thread_95 4564_V201402141 451.zip) back to my PC

                        It contains:
                        Macro Enabled PowerPoint file named:
                        Bytes_Thread_95 4564_ConnectToA ccess2010.pptm

                        This should have 4 slides.
                        Slide one and Slide two are basically twins for layout and design.
                        Slide 1: Text has description of what is going on with it
                        Slide 2: Text has description of what is supposed to happen when the presentation is ran. There is an action button, using the theme it is red, named z_ab_nextslide
                        Slide 3: Presents the data from the database (described below)
                        It has a series of actions buttons, text boxes, and a table. This slide is set to have no transition time and transistion on mouse click is disabled.
                        The text boxes of interest are named:
                        txt_people_pk
                        txt_people_Firs tName
                        txt_people_Last Name
                        txt_people_Emai l

                        The table is named: tbl_people_info

                        The actions buttons have the following icons, names, and associated VBA script
                        Icon-Stop-Left; z_ab_firstrecor d; sub ShowFirstRecord ()
                        Icon-Left; z_ab_previousre cord; sub ShowPreviousRec ord()
                        Icon-Right; z_ab_nextrecord ; sub ShowNextRecord( )
                        Icon-Stop-Right; z_ab_lastrecord ; sub ShowLastRecord( )
                        Icon-BigI; z_ab_gotofinals lide; hyperlink to next slide

                        Slide 4: Simple slide with some text describing the actions that should happen.

                        VBA:
                        Module1: This is where all of the main action codes should be running from

                        clsApplicationE vents: This has the class module that handles the cleanup code.

                        --
                        Access Database File named:
                        Bytes_Thread_95 4564_ConnectToA ccess2010_DB.ac cdb

                        The database file has:
                        tbl_people
                        [people_pk] autonumber
                        [people_FirstNam e] text(255)
                        [people_LastName] text(255)
                        [people_email] text(255)

                        Form:
                        frm_tbl_people

                        Module1:
                        zdoloop()
                        Ignore this loop. It is there from another example and has nothing to do with this project. Sorry, I should have deleted it.


                        When you open the PPTM file:
                        Hopefully you are presented with as series of prompts asking you if you want to enable macros and telling you that editing has been disabled. You will have to enable macros and allow editing.

                        You should then start out in the normal editing view.
                        [F5]
                        From there the first slide will transistion quite quickly to the second slide, hopefully the action button will be visible and green.
                        If you see the action button; however, it is red, then, click once in the slide, not on the arrow, using the keyboard right arrow to the next slide, Click on each of the record movement buttons. Using the keyboard, left arrow.
                        Tell me what happens as this point.
                        If the arrow turns green then my duplicate slide workaround didn't work and we'll have to go back to the designin board and implement things a tad differently.
                        Last edited by zmbd; Feb 18 '14, 08:57 PM. Reason: [z{fixed extention on db file name}]

                        Comment

                        • osmosisgg
                          New Member
                          • Dec 2013
                          • 51

                          #42
                          Ok - arrow is initially red. Using the keyboard arrows going forward and back turn the arrow green. (pretty cool trick, but not intentional) After that, data populates.

                          Comment

                          • zmbd
                            Recognized Expert Moderator Expert
                            • Mar 2012
                            • 5501

                            #43
                            This has to do with the events being depreciated.
                            Drat.
                            Here's another neat trick.
                            Close program
                            Open the program - nothing else
                            Now <alt><f11> to open the VBA-Editor
                            Now open the .pptm
                            [F5]
                            Seems that once VBA is started the application events work.

                            So... we can rework this so that we pull all of the start-up junk into an action button on the first slide and then advance once the db is connected, open the vba first, or take the slides route.

                            We start the ISO audit tomorrow; thus, my time is very limited today... see what you can accomplish.

                            Comment

                            • osmosisgg
                              New Member
                              • Dec 2013
                              • 51

                              #44
                              whoah - it works that way. I will research.

                              Comment

                              • zmbd
                                Recognized Expert Moderator Expert
                                • Mar 2012
                                • 5501

                                #45
                                OK, One last time to get this to work nicely, then it's death by the 57 slide method!

                                I have downloaded ( Post #16 = Bytes_Thread_95 4564_V201402191 502.zip) back to my PC

                                It contains:
                                Macro Enabled PowerPoint file named:
                                Bytes_Thread_95 4564_ConnectToA ccess2010_3.ppt m

                                This should have 4 slides.
                                Slide one and Slide two are basically twins for layout and design.

                                Slide 1: Text has description of what is going on with it.
                                The actions buttons have the following icons, names, and associated VBA script
                                Icon-right; z_ab_intnextsli de; sub starththeshow()
                                Using the theme, it starts grey, turns yellowish, runs the code, and if all goes well, resets.

                                Slide 2: Text has description of what is supposed to happen when the presentation is ran.
                                The actions buttons have the following icons, names, and associated VBA script
                                Icon-right; z_ab_nextslide; hyperlink to next slide.
                                Using the theme, it starts red, turns and if all goes well from the first slide it is green


                                Slide 3: Presents the data from the database (described below)
                                It has a series of actions buttons, text boxes, and a table. This slide is set to have no transition time and transistion on mouse click is disabled.
                                The text boxes of interest are named:
                                txt_people_pk
                                txt_people_Firs tName
                                txt_people_Last Name
                                txt_people_Emai l

                                The table is named: tbl_people_info

                                The actions buttons have the following icons, names, and associated VBA script
                                Icon-Stop-Left; z_ab_firstrecor d; sub ShowFirstRecord ()
                                Icon-Left; z_ab_previousre cord; sub ShowPreviousRec ord()
                                Icon-Right; z_ab_nextrecord ; sub ShowNextRecord( )
                                Icon-Stop-Right; z_ab_lastrecord ; sub ShowLastRecord( )
                                Icon-BigI; z_ab_gotofinals lide; sub clsnend()

                                I've also added some logic to the show next button in that the nextrecord button will turn z_ab_gotofinals lide green (using theme) upon showing the last record of the recordset and then cycling back to the start.

                                Slide 4: Simple slide with some text describing the actions that should happen.

                                VBA:
                                Module1: This is where all of the main action codes should be running from
                                This has had a view minor things added and changed. Namely the code that handles the slide change events, and a few other tweeks to get the application level events to tigger more reliably.

                                clsApplicationE vents: This has the class module that handles the cleanup code.

                                --
                                Access Database File named:
                                Bytes_Thread_95 4564_ConnectToA ccess2010_DB.ac cdb

                                The database file has:
                                tbl_people
                                [people_pk] autonumber
                                [people_FirstNam e] text(255)
                                [people_LastName] text(255)
                                [people_email] text(255)

                                Form:
                                frm_tbl_people

                                When you open the PPTM file:
                                Hopefully you are presented with as series of prompts asking you if you want to enable macros and telling you that editing has been disabled. You will have to enable macros and allow editing.

                                You should then start out in the normal editing view.
                                [F5]
                                From there the first slide will sit until you click on the icon-right, the second slide will replace the first and it will hopefully appear that the action button is visible and green. In reality, the slide changed and the two action buttons are in effect overlayed; thus, the illusion that the buttons changed.

                                Tell me what happens as this point.

                                Comment

                                Working...