[Last Call] Learn how to a build a cloud-first strategyRegister Now


Trying to get subreport to print all pictures in a specified folder

Posted on 2014-08-05
Medium Priority
Last Modified: 2014-08-11
I have the following code in an onformat event of a subreport which works fine to print the primary picture file as defined in the record table in an existing report.   But if the specified folder has more than one picture file in it I want the report to print all of the pictures in the subreport for a new report.

Here is the code which is working fine for the current report.  What do I have to do to it to make the new subreport print all of the pictures?

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    Dim strClientFolderName As String
    Dim strPropertyAssetFolderName As String
    Dim strPropertyFolderName As String

    strClientFolderName = TempVars!strPicturesDataPath & "\" & Trim(Me.txtClientTableID) & "\"
    strPropertyFolderName = strClientFolderName & Trim(Me.txtPropertyTableID) & "\"
    strPropertyAssetFolderName = strPropertyFolderName & Trim(Me.txtManualAssetN)

    Me.AssetImage.Picture = strPropertyAssetFolderName & "\" & Me.PrimaryPictureFile

End Sub

Open in new window

Question by:SteveL13
1 Comment
LVL 74

Accepted Solution

Jeffrey Coachman earned 2000 total points
ID: 40241854
Without any context, ...it is difficult to see what is happening in you code...

In any event, ...code like this will loop all .jpg images in a folder
...So if you need to: "print all of the pictures?"
...I am sure you can modify this code to work in yours

Dim strJPGFileName As String
strJPGFileName = Dir("C:\YourFolder\*.jpg", vbDirectory)
    While strJPGFileName <> ""
        MsgBox strJPGFileName
        strJPGFileName = Dir


Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question