Question

I have a Powerpoint slide that contains textboxes. I would like to link those textboxes with a filtered view of a data table in Access.

For ex, if I had a TaskList application in Access that displayed tasks with different priorities and affectations; is there a way to open that file, select that view, and filter it according to a vba (or other) onclick button event triggered from my Powerpoint presentation?

Was it helpful?

Solution

It's certainly possible to get Access data from Powerpoint.

You need to make sure you have the correct references set to theMicrosoft DAO Object Library in your VBA project.

Then, to populate your textbox in your PowerPoint presentation, you can call something like the following function, say, to return a string containing a list of Tasks matching the given TaskPriority.

Function GetTaskListFromAccess(taskPriority as Integer) as String
  Dim db As DAO.Database
  Dim rs As DAO.Recordset
  Dim listOfTasks as String

  Set db = DBEngine.OpenDatabase(“C:\my_database.accdb”)

  Set rs = db.OpenRecordset("SELECT * FROM TaskTable WHERE TaskPriority=" & _
                            taskPriority, dbOpenSnapshot)
  If not rs is nothing then
    If rs.RecordCount > 0 then
      With rs
        While Not .EOF
          if listOfTask = "" then 
            listOfTasks = !TaskName
           Else 
            listOfTasks = listOfTasks & vbCrLf & !TaskName
          End If
          .MoveNext
        Loop
      .Close
      End With
    End If
    Set rs = nothing
  End If
  Set db = nothing

  GetTaskListFromAccess = listOfTasks
End Function
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top