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!

dynamically changing the reports data source

Status
Not open for further replies.

kindred

Programmer
Feb 28, 2001
50
US
How would i go about changing the reports data source dynamically?, the source will change everytime i need to print the report, any thoughts?

Thanks,
Stephen
 
Stephen,
Forgive me for not fully understanding, but are you suggesting that the data source - the .DBF(s) will change with each running of the report? This is pretty standard. If it's just a single table that's in different locations but always the same structure, then just open it with the same ALIAS <name> each time. If it's mutiple tables then just do an SQL SELECT into a cursor that uses what ever tables you need, so that the REPORT file (.FRX) always sees the same data &quot;view&quot;. (You could also use a View, but they are a bit more difficult to create &quot;on-the-fly&quot;.)

OR, do wish to alter the format of the REPORT file (.FRX) itself, to allow different fields to be displayed or with different groupings? This too can be done, although it's a bit more complicated, and you'll need to dig into the specifications (both documented and un-documented) for how this file is used by the internal VFP REPORT code.

Rick
 
Yes, the dbf would change with each run. So I guess my real question is, how would I go about opening the .frx file.

Thanks,
Stephen
 
Stephen,

USE c:\dir1\dir2\mytable.dbf ALIAS reporttable
REPORT FORM myreport.frx && fields aliased to reporttable

....

USE x:\netdir1\anothertable.dbf ALIAS reporttable
REPORT FORM myreport.frx


As long as both (all) tables have at least the same named fields that the report requires, then the report will work.

I'm not sure why you need to open the .FRX, but since it's just a table, use can USE it.

USE myreport.frx
BROWSE
USE

Rick
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top