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
= = = = = = = = = =
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
= = = = = = = = = =