SubReport Problem (1 Viewer)

damian

Registered User.
Local time
Today, 20:58
Joined
Jun 27, 2004
Messages
87
Hi, I've been working on a report for several weeks and have yet to come up with a solution for the following setup.

On the main (parent) report I have Contact Name and address fields with a subform (SubReport1) which have been successfully linked.

SubReport1 has a child subreport SubReport2.

SubReport2 is a continuous report listing several different records that are linked to SubReport1 - again this works well. However, SubReport2 also contains linked images which I'd like to group/display/force onto a new page on the report.

To help clarify, if SubReport2 contains 3 images, I'd like for the 3 images on a separate page for that record in SubReport1.

I'm able to do this if there is only one record in SubReport1 but then it falls down after that. In order to achieve this I created another version of SubReport2 that forces a page break, makes images visible and re-sizes controls as I don't want large white gaps in the reports.

Confused.... probably but I can perhaps go into a bit more detail if anyone can assist.
 

vbaInet

AWF VIP
Local time
Today, 20:58
Joined
Jan 22, 2010
Messages
26,374
Use the DIR() function in the Record Source of your report. Group on this field. For the sorting issue (which you will encounter) just use an IIF() function.

I'm assuming when you say linked images you mean that you saved the path to the images in your db and then you're just pointing to them via this path?
 

damian

Registered User.
Local time
Today, 20:58
Joined
Jun 27, 2004
Messages
87
Attempted to look at the DIR() function as a way to overcome issue but couldn't fathom out how this can put the images on a separate page straight after a sub section of a subreport.

I can get the information to act as it should on Subreport 1 but when the Main Report is opened, it will overlook a page break on the subreport and put all images after all the records in the subreports.

One way to resolve is perhaps to pass the values for the parent/main form to unbound fields in the subreport header but I feel this is a little messy.... unless I'm unable to get further advice on the DIR() option or another method.
 

vbaInet

AWF VIP
Local time
Today, 20:58
Joined
Jan 22, 2010
Messages
26,374
I'm still unclear about this -->
I'm assuming when you say linked images you mean that you saved the path to the images in your db and then you're just pointing to them via this path?
 

damian

Registered User.
Local time
Today, 20:58
Joined
Jun 27, 2004
Messages
87
Thanks for taking time to get back to me - have opted to populate the main (parent) report fields using the form values. This means that the images can remain linked to what was SubReport1 (effectively now the parent report) and a page break can now be used to put the images/image locations onto a separate page. :D
 

damian

Registered User.
Local time
Today, 20:58
Joined
Jun 27, 2004
Messages
87
Thought I had everything sussed and now I've realised that the page break business may be causing havoc with my page numbers (eg Page 11 of 9). Only established this by searching this forum and concidentally you (vbaInet) had responded to a similar post previously.

Any idea if this issue can be overcome with VBA?
 

vbaInet

AWF VIP
Local time
Today, 20:58
Joined
Jan 22, 2010
Messages
26,374
damian,

The third I'm asking, what do you mean by "linked images"?
 

damian

Registered User.
Local time
Today, 20:58
Joined
Jun 27, 2004
Messages
87
Apologies for delay in responding.

On a form, I've used an image frame linked to a text field containing the location of the image (.bmp) on my PC. I set the text field using VBA behind button on the form. I'm using Access 2010. The images are not stored within the database to help avoid bloating

All works well but as usual I keep finding the odd problem.

Latest issue is hiding the image (removing white spaces) on a subreport after checking if the image location field (txtimagename) is not null. All OK if the first record in the subreport (continuous records) is indeed not null.

If it's null, VBA doesn't work and subsequent images are suppressed/don't appear. Code that is in the detail section of the subreport is below::banghead:

PHP:
Option Compare Database

    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
    
    If (Not IsNull([txtimagename])) Then
    
   Me.Image2.Height = 4900
   Me.Section(acDetail).Height = 4900

   Else
   
   Me.Image2.Height = 0
    Me.Description.Height = 0
     Me.Description.Visible = False
       Me.ID.Height = 0
   Me.ImageSequenceNumber.Height = 0
  Me.SurveyDetailMainFormLinkNumber.Height = 0
  Me.ImageReportName.Height = 0
  Me.DistanceM.Height = 0
      Me.Section(acDetail).Height = 0
    
      End If
End Sub
 

damian

Registered User.
Local time
Today, 20:58
Joined
Jun 27, 2004
Messages
87
Solved it by basing my subreport on a query that showed records where the text field containing the location of the image was not equal to null.
 

Users who are viewing this thread

Top Bottom