shminhas Newbie
Joined: 13 Jan 2004 Posts: 4
|
Posted: Jan 15th, 2004 04:49 AM Post subject: Images in DataReport |
|
|
I have a problem to Print the Pictures in the DataReport. I Developed the Database in Access having to fields, in one the Name of employee and other having the path of the picture of employees (In Stored hard drive). The following Program is printing the Name of employee correctly but pictures are not updating with each record. Only last path's picture is repeating in the Report. The Pictures should update according to records
Here is the source Code:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim sSql As String
Private Sub Command1_Click()
Set DataReport1.DataSource = rs
rs.MoveFirst
While rs.EOF = False
With DataReport1.Sections("section1")
.Controls("text1").DataField = rs.Fields("field_name").Name
End With
pic = rs.Fields("path")
Set DataReport1.Sections("section1").Controls("Image1").Picture = LoadPicture(pic)
rs.MoveNext
Wend
DataReport1.Refresh
DataReport1.Show
End Sub
Private Sub Form_Load()
mySql = "select * from table1"
cn.Open "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=" & App.Path & "\MYDB.mdb;" & _
"Uid=;" & _
"Pwd="
rs.Open mySql, cn, adOpenKeyset, adLockOptimistic
End Sub |
|