Click to See Complete Forum and Search --> : Graphics in DataReports


SparowHawk
July 24th, 1999, 11:58 AM
I placed an image control on a data report. I am using ADO to access a database however, I am not using a Data Environment. The following sample code functions well for populating a label:

With rptInvoice
set .DataSource = rsPrint
.Sections.Item(1).Controls.Item(1).Caption = rsPrint.Fields(6).Value
end with



Now, the table rsPrint refers to contains the full path to the graphic image I wish to use (C:\1.jpg for instance). I would have thought that using the code:

.Sections.Item(1).Controls.Item(2).Picture = LoadPicture(rsPrint.Fields(2).Value)



would work but it does not. Trying

.Sections.Item(1).Controls.Item(2).Picture = rsPrint.Fields(2).Value



also returns an error. I am absolutely sure the left hand side points to the Image control and the right hand side contains the correct path so there must be a problem in syntax. How can I load a graphic image into this graphic control?

TIA
Ken

Ravi Kiran
July 26th, 1999, 12:50 AM
For typical picture items & LoadPicture command use Set

set ....Picture = LoadPicture(...)




See example on LoadPicture. If you have trouble still, try copying the path into a local string variable and try. You can also check for File existance this way