Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing a second page with one field but only if that field has text 1

Status
Not open for further replies.

jedlag

Technical User
Aug 6, 2001
15
US
I'm using Access 2000. My form is a Hit Form for doing background checks. I'm having problems with a field called More. It's used only when all the charges do not fit in the original Charges field.
What I would like to do is design a report from this form that prints as one page. The catch is the More field. I need the More field to print out by itself on a second page of the report, but only if there is text in the field, otherwise to only print out my one page Hit Report.
I don't know code (I try to fake it occassionally, but Access takes exception or syntax ;) to what I've tried). I'm beginning to think you have to be a programmer to understand Accesses Help File. I'm going around in circles!
Please go easy on me, if it is code, step by step and what and where to push would be greatly appreciated.
 
Have you tried just setting the CanShrink property of your More field (text box)?

You may need to give details about how your report is set up (grouping, headers, footers, etc.) to get more specific help.
 
Hi Tempclerk

The Report is actually a direct copy of a form that was originally filled out by hand. Problem is, the form cannot be changed on a whim by me.

With the hand written form, you could add a second sheet of paper when needed if you had more information than you could fit on the form. That's what I'm trying to accomplish with this report. If I have an overflow of information, I want it to print out on that second page. If there is no overflow, to have only the one page print.

In essence, the form in Access looks identical to the one you fill out by hand, but with the More field on the bottom to take up the overflow information.

The Report doesn't have headers or footers. Everything is in the Details section. I tried a macro in the footer section to make the field visible if there was text in the field. It makes it visible, but it moves the lower part of my report to a second page whether there is text in the More field or not. (which makes sense, since it's a footer) I was willing to try anything at midnight!

I hope that covers some of the details, if you need more, let me know.

I thank you for any help that can be given.

jedlag
 
How about inserting a page break before the control that displays the "More" data. Set "HasModule" property to true,
then in the "OnNoData" event of the module, set Cancel = true. If this doesn't work, maybe create a subreport for the "More" data, and set the above property for the subreport?
 
I don't see anything in your explanation that would require anything other than putting your More field at the bottom of your detail section and setting the CanShrink properties of both the field (text box) and the Detail Section to Yes. I'm not sure, but I think even invisible fields still take up space. Try this and let me know exactly what happens. (Do you get extra blank pages no matter what, etc.)
 
Hi Tempclerk

I set the Can Shrink of both the More field and the Details property to Yes. I still get the extra blank sheets no matter, though for some reason, the label of the More field does not show up, even if the sheet should not be there.

I put a page break before the More field and kept the Can Shrink properties to Yes and something interesting happens. Instead of a blank sheet, the label More shows up with no information. On the sheet that the More field shows up, the label appears there too.

Don't know if what I'm saying is making sense, let me know so I can organize a little better.

Genomon,

I can't find a Has Module option for my More field, though I can find a Has Module option for the Report Properties. Am I missing something?

Thanks again for any help

jedlag
 
Labels won't shrink. Do you really need one? If so, change the name of your text box if necessary so it doesn't match the field name, then set the control source to something like Iif(IsNull([More]),Null,"Label text " & [More]). Make sure that the top of the text box is on the first page (if the printable area of your page is 10 inches, say, the TOP of the text box needs to fit in there), and make sure there is no extra space below the text box.
 
To be truthful, I don't really need the label, I just thought it was interesting how I got it to display. It never ceases to amaze me what Access will do, whether I want it to or not! ;-)

Did my explanation make sense? That I got two pages whether the More field had text or not? Sorry I was a little fuzzy earlier.

I'm at a complete loss as to how to do this. Any other ideas?

By the way, thanks for the Can Shrink. I've never used it before, though I have come up with a couple of uses for it since this morning!
 
You got it! The OnNoData event is in the report module.
Although the code is quite complex (hehe), I will include it here so you can copy & paste: Cancel = True. Write back if this doesn't fly!
 
Usually when you get extra pages it's because there is something not very obvious hanging off the edge of your printable area. Make sure that the width of your report in design view fits within your page margins, that everything other than your More field ends above the top of the More field text box, and that the top of the More field will fit within your page margins. For good measure, you might try setting the height of the More box to 0 and setting CanGrow to yes. Then drag the bottom edge of your report up as high as it will go.

I can't think of anything else at the moment that would cause this problem.
 
Temp has a great point!! If you need to check this, click on the print preview button in the toolbar, then look at the bottom of the screen at the navigation buttons. If you created 2 pages you will be able to view the second, even if blank. I used to really beat my head on the wall over this until I figured out that the page dimensions I was designing on I had inadvertently made larger than a piece of paper. If you really need to cram stuff in, you can also change the default margins (I typically use .25 inches rather than the default of 1 inch). Keep pluggin' away!
 
Hi Guys,

Sorry about that, got called out of town for the day.

I've been playing with this problem for way too long! I'm starting to get confused on what I'm doing. Here's what I have at the moment.

My pre-made form is just big/small ;-) enough to fit on one page. I can't get my More field on without making the page go automatically to 2. I've changed the margins, it's the More field that changes everything.

Now, I have a feeling I'm stuck. If I can't get the More field on the main Report, I can't make it shrink or grow for it to go onto another page if there's text in the box?

Genomon, I tried the module thing. Funniest thing I've ever seen. I made 2 very special records for this Report to play with. Instead of getting 1, 2, 3 or 4 pages (depending on your point of view), I got a total of 8 pages.

The page that I was hoping to be blank had less More fields on it than the one that should have had the More field on it. Though, I found it interesting that all the More fields on each page was not blank. It was intermixed with my More field that had text.

I tried using both the subform with the page break and just the More field. You sure there's not some kind of code I can put somewhere (not that somewhere) that says something like:
If this field blank, don't print?
Not in that language (though I have been learning new words recently!) but something of that nature?

Going (not so quietly) out of my mind
jedlag
 
Tempclerk,

Wanted to say THANKS for that Can Grow, Can Shrink. It solved another problem with a different Report. Saved on some paper!

Thanks again
jedlag
 
OK!!!

Here's what I did, though not as easy for the user as I would have liked.

I made my More field about 2 pixels high and ran it right across the bottom of the report, from margin to margin.

I changed the properties of the Detail Section and the More field to Yes on the Can Grow, Can Shrink.

In my More field on the Form, I typed
This is the first line
This is the second line
This is the third line
I know it's not the most scientific, but what I got was:
"This is the first line" on the very bottom of page one and the rest on the second page!

Here's where the user comes in...the only thing I know to do is have the user Return one time in the More field on the Form so that there is a blank line.

Any work arounds you can think of?
Many thanks, even if you don't have any ideas for this, I greatly appreciate what you've given me so far!
jedlag
 
Instead of having the user enter a return, put it in the control source of your textbox. Something like =IIf(IsNull([More]),Null,Chr(13)&[More]). Make sure first that your textbox doesn't have the same name as the field, and search the forum for &quot;carriage return&quot; if Chr(13) isn't right. (I always use <ctrl-enter>, but there are better ways.)

I still think if your More field is the very bottom thing on your report and there is no space below it you shouldn't be having this problem. Puzzling.
 
Tempclerk,

I apologize for not getting back. I found the problem, I missed putting the height of the More box to 0. That's what I get for printing these things out and not changing the ink cartridge when it's needed.

I came back and read from the page and picked up the height to 0. After that it was just a matter of experimenting with the bottom margin of the Report in Design View. Just as an aside, never put in Date parameters before having your Report complete, typing in beginning and ending dates each time you go to Print Preview becomes a pain pretty quick! ;-)

I can't say Thank You enough. You guys were great keeping it simple enough for me to understand.

Thanks Again!
jedlag
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top