Use datafields as variable to display picture ?

S

Sale

I have a report with image control named IMAGE5 in which I wanna to
display a picture .
Path to the picture is stored in table IMAGE column PATH.

The code based on details format event is :

Option Compare Database
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Image5.Picture = Me![PATH]
End Sub

but it generates a run-time error - because of null values in Me!
[PATH] .
I have set Report Record Source=IMAGE ( table with column PATH that
stores paths to the image on disc )

How can be [PATH] empty ?

What is wrong !
Thanx, Sasa
 
C

Carl Rapson

Sale said:
I have a report with image control named IMAGE5 in which I wanna to
display a picture .
Path to the picture is stored in table IMAGE column PATH.

The code based on details format event is :

Option Compare Database
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Me.Image5.Picture = Me![PATH]
End Sub

but it generates a run-time error - because of null values in Me!
[PATH] .
I have set Report Record Source=IMAGE ( table with column PATH that
stores paths to the image on disc )

How can be [PATH] empty ?

What is wrong !
Thanx, Sasa

[PATH] can be empty if nothing was put into it. You'll need to check for an
empty path when setting the Picture property:

Me.Image5.Picture = Nz(Me![PATH],"")

Carl Rapson
 
S

Sale

[PATH] can be empty if nothing was put into it. You'll need to check for an
empty path when setting the Picture property:

Me.Image5.Picture = Nz(Me![PATH],"")

Carl Rapson

That is a problem, why [PATH] is empty???

I have set Record Source to look into IMAGE.PATH that include some
value ( path to the image on disc )...
 
C

Carl Rapson

Sale said:
[PATH] can be empty if nothing was put into it. You'll need to check for
an
empty path when setting the Picture property:

Me.Image5.Picture = Nz(Me![PATH],"")

Carl Rapson

That is a problem, why [PATH] is empty???

I have set Record Source to look into IMAGE.PATH that include some
value ( path to the image on disc )...

Are you certain that every record in your IMAGE table contains an entry in
the PATH field? If you open the table, are any of the PATH entries blank?
Since I don't know how you are loading your records, I have no way of
knowing how a field could be empty.

Carl Rapson
 
S

Sale

[PATH] can beemptyif nothing was put into it. You'll need to check for
an
emptypathwhen setting the Picture property:
Me.Image5.Picture = Nz(Me![PATH],"")
Carl Rapson
That is a problem, why [PATH] isempty???
I have set Record Source to look into IMAGE.PATHthat include some
value (pathto the image on disc )...

Are you certain that every record in your IMAGE table contains an entry in
thePATHfield? If you open the table, are any of thePATHentries blank?
Since I don't know how you are loading your records, I have no way of
knowing how a field could beempty.

Carl Rapson

Here is answer : Are you certain that every record in your IMAGE table
contains an entry ....
I have some blank field ( I can't believe it .... ), after filling- it
works !

Thanx, Carl !!!!!
 
C

Carl Rapson

Sale said:
[PATH] can beemptyif nothing was put into it. You'll need to check for
an
emptypathwhen setting the Picture property:
Me.Image5.Picture = Nz(Me![PATH],"")
Carl Rapson
That is a problem, why [PATH] isempty???
I have set Record Source to look into IMAGE.PATHthat include some
value (pathto the image on disc )...

Are you certain that every record in your IMAGE table contains an entry
in
thePATHfield? If you open the table, are any of thePATHentries blank?
Since I don't know how you are loading your records, I have no way of
knowing how a field could beempty.

Carl Rapson

Here is answer : Are you certain that every record in your IMAGE table
contains an entry ....
I have some blank field ( I can't believe it .... ), after filling- it
works !

Thanx, Carl !!!!!

Glad it worked, but that should indicate to you that it is important to test
for an empty path, even if you think it is filled. Things happen.

Carl Rapson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top