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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Complex Problem

Status
Not open for further replies.

dstepans

Programmer
Jun 3, 2003
39
US
Hello,

I have a rather complex problem (at least it is for me).

I need to populate a form. It is a very strict form consisting or 2 pages.

Page one is Order page, and page 2 is Order Details page.

On the Order page there is a very detailed customer information and general order information, which takes almost the whole page, and there is a special space for order details information (like product id, quantity, price), but there is only space for 4 products. So if in the order there are 4 or less products only that page is printed.

If there are more products in order detail (more than 4), then 4 of them should be printed on Order Page and the rest on the Order Details page, if there are more products that can be printed on the Order Details page the second Order Details page shouold be used and so forth.

Forms are very strict and I can not alter them in any way.

Any ideas how I could accomplish it?

I am using VB6 and CR 8.5

TIA,
Denis
 
count the number of orders that you are processing in the detail section and then in the section expert Enable the "new page before" when your count reaches 5.

Other than that I can offer no info....since you have no details of the report itself...other than the layout...

for example

Are you filling in the blanks on an existing form or creating the form from scratch?

What kind of information is transfered to the 2/3/... pages?

Jim Broadbent

The quality of the answer is directly proportional to the quality of the problem statement!
 
Hi,
thanks for your reply.

This will not work. I am filling blanks on the existing form and on the Order page after the place where I enter 4 order details there is some other stuff that has to be printed on the page before it ends.

Pages 2/3/... are just order details pages, basically at the header of the page they have an order number and customer name and then order details section: ProductName, Quantity, Price, etc. (there is space for about 30 products there).

Denis.
 
Jim's idea should work. You could format the details section to "new page after" using a formula like:

recordnumber = 4

and then put the information that should follow the four details in a page footer section which can be suppressed using:

pagenumber <> 1

...if the information is only supposed to appear on the first page.

-LB
 
Yeap, it might work!

Sorry, I am very new to CR. How would I get the recordnumber? to know when it is 4? Basically how do I count how many Order Details records are printed? I am using a subreport to print Order Details (its a one to many rel. betw. Orders and OrderDetails tables).

Thanks,
Denis
 
In Crystal 8.5, recordnumber is a field you can test for, and which Crystal looks after.

Madawc Williams
East Anglia, Great Britain
 
Recordnumber is in a list under &quot;Special Fields&quot; in the field explorer. You can drag it onto your report canvas as you would any other field.

I'm not sure why you are using a subreport for the order details. Subreports slow reports and should be avoided if not necessary. But maybe it won't interfere with what you are trying to do.

-LB
 
Thanks guys.

That worked! How can I now move the page footer so its contents appear right under the 4th record? (right now there is a big blank space)

As I said I am very new to CR. How could I do it without using a subreport?

Denis
 
I'm assuming that the page footer on subsequent pages is smaller than on page 1. Try inserting another page footer section by going to format->section->page footer->insert. Then put your information in page footer_a and format page footer_a --again go to format section->page footer_a->suppress->x+2 and enter:

pagenumber <> 1

Then go to format secton->page footer_a and check &quot;suppress blank section&quot;

In design mode, drag the bottom border of the page footer section to make it larger and then make sure your information is placed right up next to the top border of the section. You'll have to play around with this so that the page footer is large enough to make the details white space disappear without being so large that the details all move to the next page.

-LB
 
Cool, thanks.

You also mentioned it is possible to create this report without using a subreport.
How would I do it? I am working with 3 tables Customers->Orders->OrderDetails. I am using VB6 and CR 8.5

You've been a great help, and I may be asking too much, but could you post a code or maybe a link where I could do some reading about it.

Thaks,
Denis.
 
I'm not sure that it would work, it depends on why you chose to use the subreport in the first place. Try saving your report under a different name to do a test, and then add the Orders Details table and link it to Orders. I'm assuming you're grouping on Customer and probably on Order, too. Try laying the order detail fields in the detail section and adding the page break formatting as was suggested for your subreport and see whether the resulting report meets your needs.

-LB
 
Oh, ok, gotcha.
But this way I will have to connect the CR directly to the database. While this is good in my testing enviroment, how would I set the database location when my program is installed on the client's computer?

Basically I chose to use subreport, because I didn' know how else to use CR with VB and connect it to the database.
I will need to distribute this application, so location of the database on the client's computer will be different than it is on mine. Also my application works with both SQL Server and Access databases (I just change the connection string).
So what I did I created 2 recordsets in VB one from joining Customers and Orders tables for the main report and the second recordset from OrderDetails table for the subreport.
This way I don't have to connect CR to the database at all.
I also use a ttx file for the main report (not sure if its a good solution or not).

Denis
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top