Opening/viewing reports from a combo box

I don't see where you have a Control on the Form showing the UnitNum, I only see it in the JOIN. Unless are you pulling it from tblOccupancy? Yes, as I said, both the Report and the Form pull the UnitNum field from the tblOccupancy.

Ans if you are please confirm that the name of the Control on the Form is indeed UnitNum and not tblOccupancy.UnitNum. Yes, I am confirming that is is UnitNum and NOT tblOccupancy.UnitNum - in both the Report and the Form.

Please find attached a picture of the form and the report.
 

Attachments

  • FORM.jpg
    FORM.jpg
    105.9 KB · Views: 70
  • Report.jpg
    Report.jpg
    103 KB · Views: 63
Last edited:
Images kind of small can't see too well... so moving on from that confirmation. Is this a Main Form/Subform scenario? (I know the line I posted works because I use it all the time.)
 
Yes, it is a Main Form, Sub Form scenario. But the UnitNum field is in the Main form.
 
Then I am confused because that should work. I have no explanation why it doesn't. I am assuming if you just open the report it works so I am at a loss.
 
So am I. Will provide a copy of the DB. THANk YOU
 
Here is the sample. The form to open is frmUnitUpd. There is only one report.

Don't know that this is relevant to this issue but the report only views properly in Print Preview, not Report View. It will still show up in Report View but the page break is ignored.

Thank you Gina for all your efforts. Thank you everyone for assisting.

This is important to work as many other reports will be in there...
 

Attachments

There is some code in your report:

Code:
Private Sub PageFooterSection_Format(Cancel As Integer, FormatCount As Integer)
   Call SetGrpFtrLoc(Me.Report, 8.5)
End Sub
Private Sub ReportFooter_Format(Cancel As Integer, FormatCount As Integer)
    Call SetGrpFtrLoc(Me.Report, 8.5)
End Sub

If you comment out these lines then the report runs.

So you need to explore what these lines do and what you need to do to fix them.

hth
 
Oups! The codes should not be there twice. Just for the Page Footer. Deleted the other (thank you). However, I does need to be there - it forces the footer to be at 8.5. Is that a problem?
 
the function is causing the problem. it is making many pass to the report ensuring that it will fit in 8.5 paper.

before i made the changes i copy your original report (see copy of report).
also make some modification on report Open event.

i commented out the call to the function so test first if it fits on one page.

also i think there is no need for all those subreports.

i also insert some useful modules.
 

Attachments

The problem may be that it is in there twice...

@stopher... Big THANKS!
 
No the problem was not that is was in there twice as I tested it after I removed the extra one, in there by mistake. I will open Arnel's file - thank you!
 
Wow! Thank you Arnel. Works great. I just have some questions. Please keep in mind I am sort of a newbie...

The function is causing the problem. it is making many pass to the report ensuring that it will fit in 8.5 paper.

Ok that I understand.

before i made the changes i copy your original report (see copy of report).
also make some modification on report Open event.


So, for every report I want opened from this form, I will add these codes to the Open event, right?

i commented out the call to the function so test first if it fits on one page. It does but I can't be sure for all my other reports that do work right now. I did - it works for that report anyway.

also i think there is no need for all those subreports.

I don't understand that - this is a practical way of ensuring all reports have the same header and footer, located at the same place - so consistency and no error. They are all used in almost EVERY report. It will also make it easier for the database users who have barely ever created a report. That was my thinking behind it. You really see a problem with using subreports?

i also insert some useful modules.
Yes - thank you - one for forms, one for reports. I don't understand though exactly what they do and how they will affect all other forms and reports in the database...

Does it mean that for every report to be produced from that form, it's record source will have to be linked to UnitNum from the tblUnit, right? Not that it is wrong, just need to understand it.

Also, am I to understand that I should delete the PositionRptFooter module? I found it so practical to position the footer... but if it can't be used, it can't.
 
Last edited:
Answers to the above questions, anyone? Thank you!
 
if the function is working on the other report, keep it for those.
the modules i inserted only test if a particular form/report is already open.
so test first if a report/form is open, if it does close it and open an new instance.
if you have left a report open and by mistake press the button to generate a preview of same report again, access will complain.
 
Got you! You are right, it doesn't answer all my questions but I will experiment with it. I will then keep the PositionRptFooter module. Again, thank you!
 

Users who are viewing this thread

Back
Top Bottom