By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,143 Members | 1,854 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,143 IT Pros & Developers. It's quick & easy.

how to show images linked to records on a report

P: n/a
Hey,

In my database i have images, linked to the database, corresponding to
different records. I am having trouble making them show in the report.
At the moment i can only get the one picture to show everytime.

There is a catch to the situation; the report is constructed in such a
way in that it doesn't have anything in the record source field.

I would greatly appreciate some help.

Thanks in advance,

Christina

Jun 15 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
<ch*******@hotmail.com> wrote
In my database i have images, linked
to the database, corresponding to
different records. I am having trouble
making them show in the report.
At the moment i can only get the
one picture to show everytime.

There is a catch to the situation; the
report is constructed in such a way
in that it doesn't have anything in the
record source field.
So where is it getting (1) the data to print and (2) the information to
print and move to the next record? I just can't imagine circumstances in
which it would be useful to have a Report with no RecordSource. If you can
explain how you move from record to record to print the data, then maybe I
can tell you where to put code to fill the Picture Property of the Control
with the image path-and-filename.
I would greatly appreciate some help.


The following really only is useful with bound Forms and Reports, because it
uses events that are fired by the Form or Report when it moves to a new
Record, or Prints a Record.

The sample imaging databases at http://accdevel.tripod.com illustrate three
approaches to handling images in Access, and the download includes an
article discussing considerations in choosing an approach. Two of the
approaches do not use OLE Objects and, thus, avoid the database bloat, and
some other problems, associated with images in OLE Objects.

If you are printing the images in reports, to avoid memory leakage, you
should also see MVP Stephen Lebans' http://www.lebans.com/printfailures.htm.
PrintFailure.zip is an Access97 MDB containing a report that fails during
the Access formatting process prior to being spooled to the Printer Driver.
This MDB also contains code showing how to convert the contents of the Image
control to a Bitmap file prior to printing. This helps alleviate the "Out of
Memory" error that can popup when printing image intensive reports.

Larry Linson
Microsoft Access MVP
Jun 15 '06 #2

P: n/a
Hi Larry,

Thanks for the quick response.

Ok, i didn't actually make this database, a former employee contructed
it and now we need to included images with one of the reports. The
database and it's code is very messy and hard to understand which is
why I am having so much trouble with it.

The record source on the report is empty but underneath in the 'filter'
field it has the following:

([FixturePhase] Is Null) or ([FixturePhase]= "")

I'm not sure how that relates or if that is relevant. The report does
have an 'On open' event which contains the following code:

Private Sub Report_Open(Cancel As Integer)
Dim dbs As Database
Dim strSQL
Dim rst As Recordset
Dim ProjectNameVar

Me.RecordSource = ReportFixtureSpecControlSource

strSQL = "SELECT First([Project details].[Project name]) AS [Project
name] " _
& "FROM [Project details];"

Set dbs = CurrentDb
Set rst = dbs.OpenRecordset(strSQL)

With rst
..MoveFirst
ProjectNameVar = ![Project name]
End With
Me.ProjectNameCtrl.Caption = ProjectNameVar

Dim DocNumHold
Dim SQLstrgDoc
Dim rstDoc
Dim LatestRevisionNum
Dim rstRevNum As Recordset, strsqRevNum As String

SQLstrgDoc = "SELECT [Drawing details].[Document Reference], [Drawing
details].Title From [Drawing details] WHERE ((([Drawing
details].Title)=" & """" & "Fixture Specification" & """" & "));"
Set rstDoc = dbs.OpenRecordset(SQLstrgDoc)

If Not rstDoc.RecordCount = 0 Then

With rstDoc
.MoveFirst
DocNumHold = ![Document Reference]
End With

strsqRevNum = "SELECT DISTINCTROW Max(DocRevLink.RevisionNum) AS
MaxOfRevisionNum FROM RevisionNumberMap INNER JOIN DocRevLink ON
RevisionNumberMap.RevisionNum = DocRevLink.RevisionNum GROUP BY
DocRevLink.[Document Reference] HAVING (((DocRevLink.[Document
Reference])=" & "'" & DocNumHold & "'" & "));" ' Open dynaset-type
Recordset object.
Set rstRevNum = dbs.OpenRecordset(strsqRevNum)

With rstRevNum
If .RecordCount > 0 Then

.MoveFirst
LatestRevisionNum = !MaxOfRevisionNum
Else
LatestRevisionNum = 0
End If
End With
rstRevNum.Close
Dim strsqRevLetter
Dim rstRevLetter
Dim LatestRevisionLetter

strsqRevLetter = "SELECT RevisionNumberMap.RevSign From
RevisionNumberMap WHERE (((RevisionNumberMap.RevisionNum)=" &
LatestRevisionNum & "));"
Set rstRevLetter = dbs.OpenRecordset(strsqRevLetter)
With rstRevLetter
If .RecordCount > 0 Then

.MoveFirst
LatestRevisionLetter = !RevSign
Else
LatestRevisionLetter = "/"
End If

End With
rstRevLetter.Close
Me.RevLetterCtrl.Caption = LatestRevisionLetter

If LatestRevisionNum = 0 Then
Me.RevLetterCtrl.Visible = 0
Me.RevisionLabel.Visible = 0
Else
Me.RevLetterCtrl.Visible = 1

Me.RevisionLabel.Visible = 1

End If
Set dbs = Nothing
DoCmd.Maximize
Else
MsgBox "You need to have a specification document called 'Fixture
Specification' or the revision letter feature of the report will not
function. Ensure correct spelling!"
End If

End Sub

I hope that code helps because I am having great trouble understanding
it.

Thank you again for your help.

Cheers,

Christina

Jun 15 '06 #3

P: n/a
Hey Larry,

I just took another look at the code and found the line below:
Me.RecordSource = ReportFixtureSpecControlSource


I have found the same line in a module although it only says:

Public ReportFixtureSpecControlSource

Hope that sheds some more light on the situation.

Christina

Jun 15 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.