Click to See Complete Forum and Search --> : Datareport1 & image1
groval
Apr 12th, 2006, 10:29 AM
Hi everyones..
I-m really headache with try to put image into report1.... I have a path string saved in a access database named imageDB and other data relators like name and last name . This path (imageDB) is a image file (jpg) and i want to show this photo image in a datareport1. Would you like help me and show me how i make that... ??
REgards..
Hack
Apr 12th, 2006, 10:49 AM
Moved to reporting section
brucevde
Apr 12th, 2006, 10:50 AM
You can't set the rptImageControl to a different image per record. It was meant to be used to display a single image per report, like a company logo.
If you are only showing one record per report, then you could use the following, assuming your datasource for the report is an ADO recordset.
datareport1.Sections("section1").Controls(1).Picture = LoadPicture(rs.Field(Picture Path Field Name)).Value)
groval
Apr 12th, 2006, 11:48 AM
I HAVE THIS
With DRCaracteristicas.Sections("Sección1").Controls
.Item("Image1").Picture = LoadPicture(rstcaracter!photo).Value
end wtih
where image1 is a image control
and rstcaracter is a recordset
the in the the applicattion report an error
"Data source not valid"
Why ..??
Please any help
Regards
brucevde
Apr 12th, 2006, 11:58 AM
This line
LoadPicture(rstcaracter!photo).Value
should be
LoadPicture(rstcaracter!photo.Value)
You may also need a Set as in
Set .Item("Image1").Picture = LoadPicture(rstcaracter!photo.Value)
groval
Apr 12th, 2006, 12:05 PM
same error
"data source not valid"
i delete the code line and the app no reprt the error..!!
brucevde
Apr 12th, 2006, 12:07 PM
Is rstcaracter an ADO recordset?
Did you set the reports datasource? Ie Set DRCaracteristicas.DataSource = rstcaracter
Post all your code.
groval
Apr 12th, 2006, 12:13 PM
<
Public Sub ReporteCARACTERISTICAS()
Set rstcaracter = New ADODB.Recordset
rstcaracter.CursorLocation = adUseClient
rstcaracter.Open strQueryCaracter, cnn1, adOpenDynamic, adLockPessimistic
X = rstcaracter.RecordCount
'------------------------------------------------------------------------------------------
'This sample to display Report direct from database without any additional
' operation like add data, combine and etc
'------------------------------------------------------------------------------------------
With DRCaracteristicas.Sections("Sección1").Controls 'section1 mean that section you create in datareport
.Item("texto1").DataField = rstcaracter("Estatura").Name
.Item("texto2").DataField = rstcaracter("Contextura").Name
.Item("texto3").DataField = rstcaracter("Peso").Name
.Item("texto4").DataField = rstcaracter("Color_Cutis").Name
.Item("texto5").DataField = rstcaracter("Color_Cabello").Name
.Item("texto6").DataField = rstcaracter("Color_Barba").Name
.Item("texto7").DataField = rstcaracter("Nariz_Base").Name
.Item("texto8").DataField = rstcaracter("Nariz_Dorso").Name
.Item("texto9").DataField = rstcaracter("Boca").Name
.Item("texto10").DataField = rstcaracter("Labios").Name
.Item("texto11").DataField = rstcaracter("Menton").Name
.Item("texto12").DataField = rstcaracter("Lobulo").Name
.Item("texto13").DataField = rstcaracter("Raza").Name
.Item("texto14").DataField = rstcaracter("observaciones").Name
' .Item("image1").DataField = rstcaracter("fotografia").Name
'imagen = IIf(IsNull(rstProfiles("fotografia")), "", (rstProfiles("fotografia")))
Set .Item("Image1").Picture = LoadPicture(rstcaracter!fotografia.Value)
End With
'To Set Label caption
With DRCaracteristicas.Sections("Sección1").Controls
.Item("etiqueta1").Caption = "Estatura"
.Item("etiqueta2").Caption = "Contextura"
.Item("etiqueta3").Caption = "Peso"
.Item("etiqueta11").Caption = "Color_Cutis"
.Item("etiqueta5").Caption = "Color_Cabello"
.Item("etiqueta6").Caption = "Color_Barba"
.Item("etiqueta7").Caption = "Nariz_Base"
.Item("etiqueta8").Caption = "Nariz_Dorso"
.Item("etiqueta10").Caption = "Boca"
.Item("etiqueta13").Caption = "Labios"
.Item("etiqueta21").Caption = "Menton"
.Item("etiqueta22").Caption = "Lobulo"
.Item("etiqueta23").Caption = "Raza"
.Item("etiqueta24").Caption = "observaciones"
End With
With DRCaracteristicas.Sections("Sección4").Controls
If IdONT = 1 Then
.Item("etiqueta9").Caption = "CARACTERISTICAS FISICAS"
.Item("etiqueta17").Caption = "Caracteristicas Fisicas"
.Item("etiqueta12").Caption = FrmQuienEsQuien.Text1.Text
.Item("etiqueta14").Caption = FrmQuienEsQuien.Text2.Text
.Item("etiqueta15").Caption = FrmQuienEsQuien.Text4.Text
.Item("etiqueta16").Caption = FrmQuienEsQuien.Text3.Text
Else
.Item("etiqueta9").Caption = "CARACTERISTICAS FISICAS"
.Item("etiqueta17").Caption = "Caracteristicas Fisicas"
.Item("etiqueta12").Caption = FrmQuienEsQuienONTS.Text1.Text
.Item("etiqueta14").Caption = FrmQuienEsQuienONTS.Text2.Text
.Item("etiqueta15").Caption = FrmQuienEsQuienONTS.Text4.Text
.Item("etiqueta16").Caption = FrmQuienEsQuienONTS.Text3.Text
End If
End With
With DRCaracteristicas.Sections("Sección5").Controls
.Item("etiqueta26").Caption = "TOTAL REGISTROS IMPRESOS " & " " & X
End With
DRCaracteristicas.Caption = "REPORTE CARACTERISTICAS FISICAS"
Set DRCaracteristicas.DataSource = rstcaracter
'show datareport
DRCaracteristicas.Show
End Sub
>
brucevde
Apr 12th, 2006, 12:53 PM
I see nothing wrong with the code. If the error occurs when loading the picture, it may be an invalid filename or invalid jpg file.
Can you post the jpg file?
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.