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

Add a column to report at runtime?

Status
Not open for further replies.

TivagVCH

Programmer
Jun 2, 2006
5
VN
I have difficult with my report. I want add a column to report at runtime, but I don't know it. Help me!
 
I'm not sure what you're trying to accomplish, but I would suggest adding the column at design time. Use "Print when" to keep the items in the column from printing when they're not wanted.

Jim
 
May be you don't understand with my idea. I only want to print fields that selected from a listbox, each of field will containted a column of report. Here is problem.
I don't understand about "Print when". Please explain me!
Thanks!
 

TivagVCH,

It's very difficult to select fields for printing at run time. You have to understand the contents of the report's FRX file and change it dynamically. I don't recommend you try to do this, unless you really understand the issues.

An alternative approach might be to add an extra column to your report at design time. Set its expression to, say, MyField. Make it wide enough to hold the contents of any of the user-selected fields.

Then, add a new field called MyField to the cursor or table that drives the report. At run time, fill this field with the contents of the field that the user selected.

Hope this makes sense.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
You could use the Quick Report:

CREATE REPORT xxx FROM cursor

It won't give you a gorgeous result, but it'll work.

Another alternative is to set up the maximum number of columns you'll need and specify the data as FIELD(1), FIELD(2), etc., so you don't have to know the names.

In either case, you'll want to use the choices from the list in a query to put the exact data you want into a cursor.

Tamar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top