Need coding help!

tscotti

Registered User.
Local time
Today, 17:06
Joined
Aug 15, 2004
Messages
47
From a classic Orders / Order Details db, I'm trying to display images in a report whose record details have one or more image links. In other words, I want to assign the image from OrderDetail1 to ImageFrame1, OrderDetail2 to ImageFrame2, OrderDetail3 to ImageFrame3, and so on.

I'm using the code below but I don't know how to fit the next record detail's image.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error Resume Next
showImageFrames
Me![ImageFrame1].Picture = Me![ImageFile]
End Sub

Sub showImageFrames()
Me![ImageFrame1].Visible = True
End Sub​

Any help is greatly appreciated!

Thanks,

Tony
 
Please post topics that are more related to your problem. You will get more replies that way.
 
Sorry.

Where should I post this issue?

Thanks,

Tony
 
I meant you might want to try giving a better subject to your thread. Some of our elite members ignore requests that just say "HELP" in the topic. More detail is usually appreciated. :)
 
Referencing a control, has several syntaxes, one is

Me("ImageFrame1") so, you can also do this,

Me("ImageFrame" & x) so, you can also do this,

For x = 1 to 8
Me("ImageFrame" & x).Picture = Me![ImageFile]
Next

Just to give you some ideas...
 
Thanks DB7!

Do I need to define a recordset since I want to target the subform's records and not the main form's?
 
No, you could use this syntax.


Me!sfrmName.Form("ImageFrame" & x).Picture = Me![ImageFile]
 
Thanks DB7 for your response.

Unfortunately, If I have 2 subrecords, the procedure will iterate 6 times because I have 3 ImageFrames. If I have 3 subrecords, it'll iterate 9 times, and so on. Eventually, all three ImageFrames will display the same image!

Below is the code I'm using:

Thanks, in advance, for any help offered.

Tony

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error Resume Next
Dim x As Integer
Dim ImageFrame As String

DoNotShowImageFrames

For x = 1 To 3
Me("ImageFrame" & x).Picture = Me![ImageFile]
Next x

showImageFrames

End Sub

Sub showImageFrames()
Me![ImageFrame1].Visible = True
Me![ImageFrame2].Visible = True
Me![ImageFrame3].Visible = True
End Sub​
 
It should iterate 3x per record, as expected.
Sorry Tony, it was just a guide, you need to alter which ImageFile
corresponds with what imageframe.

What is held in Me[ImageFile)? a file path?
]
 
Can anyone point me in the right direction as to how to do this?

Please!
 
tscotti, how do you expect them not, to show the same image?

If 3 image controls, in one record, all take the same file path???

What are you expecting. 3 different images, for each record?
If so, Is there somewhere we can get the other paths?
 
Tony,
does it come down to, something like this,

For x = 1 To 3
Me("ImageFrame" & x).Picture = Me("ImageFile" & x & ".bmp")
Next x
 
DB7, thanks for listening.

Perhaps, I wasn't clear in describing my issue.

My Orders report contains records from the main form and detail records from the subform. A typical order must be printed on one page and can include 1 to 3 subitems that are printed in the details section of the report. Each subitem (detail) has a corresponding value in the field (ImageFile) which contains a link to a JPG image. If I place an image control in the details section of the report, the images (up to 3) will display fine - no problem.

But that's not what I want. I need to have the image control in the FOOTER section of the report. So I created three image controls (ImageFrame1 to ImageFrame3) in the footer section as placeholders for the images whose links are in the details section.

The problem is that I don't know how to program Access to have the image from the first detail record go to ImageFrame1, the image from the second detail (of the same order) go to ImageFrame2, and so on.

I've tried creating a recordset, using NextRecord, MoveNext, etc.. but nothing seems to work.

Thanks again for any help offered.
 
This is not working, on my report.
The image results, are one step ahead of rthe current record.
Outside of that, it works.
excuse the strange sequencing of the image control, just aesthetics.


Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo xxx

Dim rec As New adodb.Recordset, v

rec.Open "SELECT * FROM OrderDetails WHERE fkOrderID =" & pkOrderID, _
CurrentProject.Connection, adOpenDynamic, adLockReadOnly

With rec

v = DCount("pkOrderDetailsID", "OrderDetails ", "fkOrderID =" & pkOrderID)
rec.MoveFirst

Select Case v '.RecordCount
Case 1
Me("ImageFrame1" ).Picture = Null
Me("ImageFrame2" ).Picture = !ImageFile
Me("ImageFrame3" ).Picture = Null
Case 2
Me("ImageFrame1" ).Picture = !ImageFile: .MoveNext
Me("ImageFrame2" ).Picture = Null
Me("ImageFrame3" ).Picture = !ImageFile
Case Else
Me("ImageFrame1" ).Picture = !ImageFile: .MoveNext
Me("ImageFrame2" ).Picture = !ImageFile: .MoveNext
Me("ImageFrame3" ).Picture = !ImageFile
End Select

End With

CleanUp:
rec.Close
Nada:
Set rec = Nothing

Exit Sub
xxx:
If Err.Number = 3021 Then
Resume Nada
Else
MsgBox Err.Number & vbCrLf & Err.Description
Resume CleanUp
End If

End Sub
 
Hi Tony, didn't have time to explain yesterday.
point is, it wasn't in sequence, due to the formatting, of my report.
I would recommend, not putting image controls, in page footer.
but in details section, below subreport?

But maybe you know more about reports than I do, and you can
sync the page record, with the page footer.
When i get time, i'm going to keep trying(with page footer). I've got a vendetta now!
 
Thanks for all your help DB7.

I appreciate it very very very much!

Regards,

Tony
 

Users who are viewing this thread

Back
Top Bottom