Hi Guys..,
I Really hope you can help, this is driving me crazy....
I have a data table "earnings" which holds err... earnings <grin> with things like date, person, amount etc..
I want to do a summary for a given date, so I run a query:-
SELECT Earnings.e_date_s;
FROM earnings;
GROUP BY Earnings.e_date_s;
ORDER BY Earnings.e_date_s DESC;
INTO TABLE data\tmp_date_summary.dbf
Group it all together and populate a grid with the list of dates for the user to select from.
When the user double clicks on the date, this trigers another sql statement to select all earnings for that date:-
SELECT Earnings.*, D_head.*;
FROM ;
earnings ;
LEFT OUTER JOIN d_head ;
ON Earnings.e_d_id = D_head.d_id;
WHERE Earnings.e_date_s = tmp_date_summary.e_date_s;
ORDER BY D_head.d_stage_n;
INTO TABLE c:\temp\tmp_dance_summary.dbf
d_head = header details for the dancers, so i can print their name along side the earnings...
Then run the report..... <pause for dramatic effect>
The report previews ok (even taken out the preview) but, when you click on the preview to zoom in/out or print the report, the report data source changes to the list of dates from "tmp_date_summary.dbf"
I have tried loads of different things (I don't give up easily)
Including:-
rewriting the report from scratch.
Making sure that I "SELECT" the correct table.
Add the tmp data table to the report.
I thought about closing the "date selection" form but I want to keep the date selection screen open so the user can print a different summary if need be.... just had an brain wave....
and It worked.... YEAH... I'm so happy.....
but i thought i would still post incase others have a similar problem, or somone can explain why this has happened....
I changed the recordsource to "" from the "date selection" form before running the second query, and put the recordsource back after the report printed.... i.e.
********************************
THISFORM.grid1.RecordSource = ""
SET SAFETY OFF
SELECT Earnings.*, D_head.*;
FROM ;
earnings ;
LEFT OUTER JOIN d_head ;
ON Earnings.e_d_id = D_head.d_id;
WHERE Earnings.e_date_s = tmp_date_summary.e_date_s;
ORDER BY D_head.d_stage_n;
INTO TABLE c:\temp\tmp_dance_summary.dbf
SET SAFETY ON
SELECT tmp_dance_summary
IF RECCOUNT("tmp_dance_summary") > 0
SET PRINTER TO NAME GETPRINTER()
REPORT FORM reports\dancer_summary PREVIEW
ELSE
=MESSAGEBOX("Sorry, no information to print",0+16,"No Data")
ENDIF
THISFORM.grid1.RecordSource = "tmp_date_summary"
******************************************
I hope this helps.....
Regards
Steve
Watch ya back, because some times the devil drives a minibus.
I Really hope you can help, this is driving me crazy....
I have a data table "earnings" which holds err... earnings <grin> with things like date, person, amount etc..
I want to do a summary for a given date, so I run a query:-
SELECT Earnings.e_date_s;
FROM earnings;
GROUP BY Earnings.e_date_s;
ORDER BY Earnings.e_date_s DESC;
INTO TABLE data\tmp_date_summary.dbf
Group it all together and populate a grid with the list of dates for the user to select from.
When the user double clicks on the date, this trigers another sql statement to select all earnings for that date:-
SELECT Earnings.*, D_head.*;
FROM ;
earnings ;
LEFT OUTER JOIN d_head ;
ON Earnings.e_d_id = D_head.d_id;
WHERE Earnings.e_date_s = tmp_date_summary.e_date_s;
ORDER BY D_head.d_stage_n;
INTO TABLE c:\temp\tmp_dance_summary.dbf
d_head = header details for the dancers, so i can print their name along side the earnings...
Then run the report..... <pause for dramatic effect>
The report previews ok (even taken out the preview) but, when you click on the preview to zoom in/out or print the report, the report data source changes to the list of dates from "tmp_date_summary.dbf"
I have tried loads of different things (I don't give up easily)
Including:-
rewriting the report from scratch.
Making sure that I "SELECT" the correct table.
Add the tmp data table to the report.
I thought about closing the "date selection" form but I want to keep the date selection screen open so the user can print a different summary if need be.... just had an brain wave....
and It worked.... YEAH... I'm so happy.....
but i thought i would still post incase others have a similar problem, or somone can explain why this has happened....
I changed the recordsource to "" from the "date selection" form before running the second query, and put the recordsource back after the report printed.... i.e.
********************************
THISFORM.grid1.RecordSource = ""
SET SAFETY OFF
SELECT Earnings.*, D_head.*;
FROM ;
earnings ;
LEFT OUTER JOIN d_head ;
ON Earnings.e_d_id = D_head.d_id;
WHERE Earnings.e_date_s = tmp_date_summary.e_date_s;
ORDER BY D_head.d_stage_n;
INTO TABLE c:\temp\tmp_dance_summary.dbf
SET SAFETY ON
SELECT tmp_dance_summary
IF RECCOUNT("tmp_dance_summary") > 0
SET PRINTER TO NAME GETPRINTER()
REPORT FORM reports\dancer_summary PREVIEW
ELSE
=MESSAGEBOX("Sorry, no information to print",0+16,"No Data")
ENDIF
THISFORM.grid1.RecordSource = "tmp_date_summary"
******************************************
I hope this helps.....
Regards
Steve
Watch ya back, because some times the devil drives a minibus.