code_junkie

Linking Powerpoint and Access through VBA?

Nov 12th, 2011
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Function GetTaskListFromAccess(taskPriority as Integer) as String
  2. Dim db As DAO.Database
  3. Dim rs As DAO.Recordset
  4. Dim listOfTasks as String
  5.  
  6. Set db = DBEngine.OpenDatabase(“C:my_database.accdb”)
  7.  
  8. Set rs = db.OpenRecordset("SELECT * FROM TaskTable WHERE TaskPriority=" & _
  9. taskPriority, dbOpenSnapshot)
  10. If not rs is nothing then
  11. If rs.RecordCount > 0 then
  12. With rs
  13. While Not .EOF
  14. if listOfTask = "" then
  15. listOfTasks = !TaskName
  16. Else
  17. listOfTasks = listOfTasks & vbCrLf & !TaskName
  18. End If
  19. .MoveNext
  20. Loop
  21. .Close
  22. End With
  23. End If
  24. Set rs = nothing
  25. End If
  26. Set db = nothing
  27.  
  28. GetTaskListFromAccess = listOfTasks
  29. End Function
Add Comment
Please, Sign In to add comment