Results 1 to 9 of 9

Thread: Datareport1 & image1

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Posts
    91

    Arrow Datareport1 & image1

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

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Datareport1 & image1

    Moved to reporting section

  3. #3
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Datareport1 & image1

    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)

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Posts
    91

    Re: Datareport1 & image1

    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

  5. #5
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Datareport1 & image1

    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)

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Posts
    91

    Re: Datareport1 & image1

    same error

    "data source not valid"

    i delete the code line and the app no reprt the error..!!

  7. #7
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Datareport1 & image1

    Is rstcaracter an ADO recordset?
    Did you set the reports datasource? Ie Set DRCaracteristicas.DataSource = rstcaracter
    Post all your code.

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Oct 2004
    Posts
    91

    Re: Datareport1 & image1

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

  9. #9
    PowerPoster
    Join Date
    Oct 2002
    Location
    British Columbia
    Posts
    9,758

    Re: Datareport1 & image1

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width