Ejemplo Código Dynamic Reports

Sub OnFormat

ON ERROR RESUME NEXT

ErrorTrobat=0

rpt.image1.Picture = LoadPicture("\\imperfy_vento\imperfy\ERP\PRESUPUESTOS\PR000000\SIN.JPG")

rpt.image1.Picture = LoadPicture("\\imperfy_vento\imperfy\ERP\PRESUPUESTOS\" & rpt.fields("idserieoferta").Value & "\CAP\CAP" & rpt.fields("ncapitulo").Value & "1.jpg")

rpt.label25.caption = "\\imperfy_vento\imperfy\ERP\PRESUPUESTOS\" & rpt.fields("idserieoferta").Value & "\CAP\CAP" & rpt.fields("ncapitulo").Value & "1.jpg"

if err.number<>0 then

ErrorTrobat=1

end if

rpt.image2.Picture = LoadPicture("\\imperfy_vento\imperfy\ERP\PRESUPUESTOS\PR000000\SIN.JPG")

rpt.image2.Picture = LoadPicture("\\imperfy_vento\imperfy\ERP\PRESUPUESTOS\" & rpt.fields("idserieoferta").Value & "\CAP\CAP" & rpt.fields("ncapitulo").Value & "2.jpg")

rpt.image3.Picture = LoadPicture("\\imperfy_vento\imperfy\ERP\PRESUPUESTOS\PR000000\SIN.JPG")

rpt.image3.Picture = LoadPicture("\\imperfy_vento\imperfy\ERP\PRESUPUESTOS\" & rpt.fields("idserieoferta").Value & "\CAP\CAP" & rpt.fields("ncapitulo").Value & "3.jpg")

'rpt.image4.Picture = LoadPicture("\\imperfy_vento\imperfy\ERP\PRESUPUESTOS\PR000000\SIN.JPG")

'rpt.image4.Picture = LoadPicture("\\imperfy_vento\imperfy\ERP\PRESUPUESTOS\" & rpt.fields("idserieoferta").Value & "\CAP\CAP" & rpt.fields("ncapitulo").Value & "4.jpg")

if ErrorTrobat=0 then

rpt.sections("EncabezadoDelGrupo0").height=3075

else

rpt.sections("EncabezadoDelGrupo0").height=400

end if

End

Sub