Dynamic Slide Update from Access DB

  • Thread starter Thread starter Billy Mason
  • Start date Start date
B

Billy Mason

I am looking for a way to dynamically update a slide presentation with
current data from an Access Database (i.e. dislaying a list of current
winning tickets from a prize drawing). I have the following code used
to extract the current winning tickets from the database; but I am at
a loss on how to update the slide in the presentation with the winners
(I envision placing the winning ticket numbers in a textbox).

= = = = = = = = = =
Sub GetWinners()
'
Dim dbpath As String
Dim DBtable As String
Dim the_nbrs As String
Dim ticketnum As String

'Setup your database interface
here---------------------------------------
'Path to Access DB
dbpath = "D:\xxxxxxx\xxxxxxxx.mdb"
'table of winning tickets
DBtable = "tbl_Winners"
'field name of Ticket Number
ticketnum = "WnTckt#"
'is this a current number (0 or 1)
currentnum = "WnActive"
'--------------------------------------------------------------------------

'do not edit beyond this line unless you know what your doing
Set conDB = New ADODB.Connection
Set rsWINNERS = New ADODB.Recordset

conDB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=" & dbpath & ";Mode=Read;Persist Security Info=False"
conDB.Open

With rsWINNERS
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
.Open "tbl_Winners", conDB, , , adCmdTable
End With

rsWINNERS.Sort = ticketnum

rsWINNERS.MoveFirst

'currentnum = "0" ... not current
'currentnum = "1" ... is current
rsWINNERS.Filter = currentnum & " = '1'"

'start loop to get all wining tickets
For i = 1 To rsWINNERS.RecordCount
the_nbrs = the_nbrs & " " & rsWINNERS(ticketnum)
rsWINNERS.MoveNext
Next

'now place the space delimited "the_nbrs" string into the text box

End Sub
= = = = = = = = = =
 
From within PowerPoint, you could do:

' this should all be on one line
ActivePresentation.Slides(42).Shapes(24).TextFrame.TextRange.Text = the_nmbrs

That'll set the text in shape 24 on slide 42 to the string you've created

This links to info that explains how to automate PPT from an external VB app:

How to automate PowerPoint using VB
http://www.rdpslides.com/pptfaq/FAQ00115.htm
 
[CRITICAL UPDATE - Anyone using Office 2003 should install the critical
update as soon as possible. From PowerPoint, choose "Help -> Check for
Updates".]

Hello,

As you have discovered, PowerPoint does not provide that level of
integration with data sources (such as Access) without resorting to
programming.

If you (or anyone else reading this message) thinks that is important for
PowerPoint to provide built in support for consuming, viewing and/or
interacting with external data (without having to resort to VBA or
add-ins), don't forget to send your feedback to Microsoft at:

http://register.microsoft.com/mswish/suggestion.asp

As with all product suggestions, it's important that you not just state
your wish but also WHY it is important to you that your product suggestion
be implemented by Microsoft. Microsoft receives thousands of product
suggestions every day and we read each one but, in any given product
development cycle, there are only sufficient resources to address the ones
that are most important to our customers so take the extra time to state
your case as clearly and completely as possible.

IMPORTANT: Each submission should be a single suggestion (not a list of
suggestions)

John Langhans
Microsoft Corporation
Supportability Program Manager
Microsoft Office PowerPoint for Windows
Microsoft Office Picture Manager for Windows

For FAQ's, highlights and top issues, visit the Microsoft PowerPoint
support center at: http://support.microsoft.com/default.aspx?pr=ppt
Search the Microsoft Knowledge Base at:
http://support.microsoft.com/default.aspx?pr=kbhowto

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
Back
Top