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!

VFP6 Report loses Dataenviroment 1

Status
Not open for further replies.

hjohnson

Programmer
Aug 1, 2001
90
US
I know this is probably something simple I'm overlooking, but I not sure what the problem is.

I've got a form with a grid using a Cursor which list contains a list of orders. Clicking on the order passes the order number to a program as a parameter. A new cursor is created generated for the report and the report (or in this case a sheet of labels) is executed as:
label form coupon to printer prompt preview noconsole

This all works great until either the preview itself or the print button is clicked at which point the alias seems to switch back to the cursor used in grid on the form and my labels sure don't look like I want them to.

Can someone help me realize what I'm not doing that I should be.

Thanks

HJ
 
Hi HJ,

FoxPro can be quirky when it comes to report data environments. I'd try explicity SELECTing the report cursor right before your LABEL statement.

SELECT reportcursor
label form coupon to printer prompt preview noconsole

Jim
 
HJ,

I'd go along with Jim. In addition, make sure that none of your report fields have an alias built into the expression. For example, if your main cursor is called CursorA, and you have a field on the report whose expression is something like CursorB.MyField, you should remove the "CursorB." from the expression.

Mike


Mike Lewis
Edinburgh, Scotland

My Visual Foxpro web site: My Crystal Reports web site:
 
Thanks Mike and Jim for the suggestions. I tried both with out any change in the outcome. Although initially, I hadn't explicitly selected the alias used in the report, I added as Jim suggested. The Report simply contained field names without being aliased. I added the alias to all output fields and still the same result.

The strange thing about this is that if send it directly to the printer without the preview option, it works just fine. I've had this problem before and have never been able to correct it. Perhaps there is something in my general enviroment or settings that causes the problem. One thing that I have noticed that helps, is to actually create something or active something other than the form or object where the report is called from so that the focus is moved elsewhere. My assumption being that the form (or in this case, the grid on the form) is very possessive and what to regain the focus and manages to do so whenever something is clicked. Not sure if all that made any sense, but if it does and provides the least little bit of light needed to solve the problem, I will be forever in your debt.

Thanks
HJ
 
hjohnson

I added the alias to all output fields and still the same result

The suggestion was NOT to added the alias to the field names.
Do you have any tables in the dataenvironment of the report? If so remove them. As Jim points out the Dataenvironemt of a report can be quirky.

So to recap.
[ol][li]No table references in the report fields.[/li]
[li]No tables in the DE of the report.[/li]
[li]Select your final cursor just before you go to the report.[/li][/ol]

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,

I've tried the report with and without the field being aliased and I have nothing in the report's DE.

Thanks
HJ
 
HJ,

Could it be that the report uses a UDF or other function that selects a different table?

Jim
 
Jim

Could it be that the report uses a UDF or other function that selects a different table?

Good call!!


Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top