heyday2004
asked on
Open Access report in separate windows
I have a form displaying a list of reports (one lines corresponds to a Customer Code in the report), when user double click one line or selecte multiple lines, the related reports will be opened in a separate window. And in that window, each report can be exported separately based on the selected Customer code.
I used this query for the report query:
...
fltSQL0 = "[Customer_CODE] in ('12', '195')"
...
DoCmd.OpenReport "rptTemplate", acViewPreview, , fltSQL0
But I found the reports for customer code '12' and '195' are in the same page and in the same report. How could I open the report seperately (my purpose is users could save report for '12' and report for '195' separately)?
Access report in seperate windows.
I tried below query, still get the two reports in one page:
fltSQL1 = "[Customer_CODE] in ('12')"
fltSQL2 = "[Customer_CODE] in ('195')"
...
DoCmd.OpenReport "rptTemplate", acViewPreview, , fltSQL1
DoCmd.OpenReport "rptTemplate", acViewPreview, , fltSQL2
Thanks for the help.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Tramtrak:
Seems I had some problem with your code: I got compile error at this line:
Set rpt(i) = New rptTemplate
rptTemplate is the name of my report, seems it could not be used like this. Could you let me know how to correct it? Thanks.
Seems I had some problem with your code: I got compile error at this line:
Set rpt(i) = New rptTemplate
rptTemplate is the name of my report, seems it could not be used like this. Could you let me know how to correct it? Thanks.
ASKER
TextReport:
You said: "why don't you give them the option to do the export instead of the preview of the report."
This is exactly what I want, but seems if you don't open the preview of the report first, you could not export it. How to export all the reports directly? Please give me more details. Thanks a lot.
You said: "why don't you give them the option to do the export instead of the preview of the report."
This is exactly what I want, but seems if you don't open the preview of the report first, you could not export it. How to export all the reports directly? Please give me more details. Thanks a lot.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, no compiling error now, but still not working:
Here is simplified code by comparing using DoCmd.OpenReport and your dynamic method:
' Case 1: Working
fltSQL = "[Date] = #4/13/2009# AND [Customer_CODE] = ('12')"
DoCmd.OpenReport "rptTest", acViewPreview, , fltSQL
' Case 2: Not working: The windows shows "Running query ..." and freeze there
Dim rpt As Report
Set rpt = New Report_rptTest
rpt.Filter = "[Date] = #4/13/2009# AND [Customer_CODE] = ('12')"
rpt.FilterOn = True
rpt.Visible = True
Any hint on making case 2 working? Thanks.
Here is simplified code by comparing using DoCmd.OpenReport and your dynamic method:
' Case 1: Working
fltSQL = "[Date] = #4/13/2009# AND [Customer_CODE] = ('12')"
DoCmd.OpenReport "rptTest", acViewPreview, , fltSQL
' Case 2: Not working: The windows shows "Running query ..." and freeze there
Dim rpt As Report
Set rpt = New Report_rptTest
rpt.Filter = "[Date] = #4/13/2009# AND [Customer_CODE] = ('12')"
rpt.FilterOn = True
rpt.Visible = True
Any hint on making case 2 working? Thanks.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Still not working. The Filter query is actually the same with the one in Case 1: fltSQL. So in case 2:
Set rpt = New Report_rptTest will open a new report like DoCmd.OpenReport ...? Thanks for the help.
Set rpt = New Report_rptTest will open a new report like DoCmd.OpenReport ...? Thanks for the help.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I did check and it is set to YES in form design view (properties). Any hint? Is the New key word to open a report like DoCmd.OpenReport?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
TextReport:
Sorry I missed your answer. I want to export each report (for each line) to two seperate files (one in xls, one in rtf), without the report preview popup. I've opened another similar (but still different) question. Thanks for your help.
Sorry I missed your answer. I want to export each report (for each line) to two seperate files (one in xls, one in rtf), without the report preview popup. I've opened another similar (but still different) question. Thanks for your help.
ASKER