Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting

Post new topic   Reply to topic
Images in DataReport
View previous topic :: View next topic  
Author Message
shminhas
Newbie


Joined: 13 Jan 2004
Posts: 4

PostPosted: Jan 15th, 2004 04:49 AM    Post subject: Images in DataReport Reply with quote

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
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » Database & Reporting All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic