If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
2 intances of the same report
hi
im trying to open the same report twice using vb code. I tried to use DoCmd.OpenReport but when i write it twice, it still opens only one instance. How can i make more instances of the same report and present them ? I used also : Dim rpt As New Report_rptOrder rpt.Visible = True but it just flashes on the screen and closes. |
#2
|
|||
|
|||
2 intances of the same report
The New keyword is the approach you have to take.
But the report then depends on the variable you created. When the routine exists, the variable is cleaned up, and so the report is closed. Since this all happens very fast, you just see the report flash and disappear. You therefore need a way to manage the various instances. You can do that with a custom collection. But there is a problem. The whole point of opening multiple instances of the same report object is that you want to filter them differently. Since you are using the New keyword to generate them, there is no WhereCondition like OpenReport has, so you must programmatically set the Filter of each instance in its Open event. The trouble is that there is a bug in how Access applies the filter, so it is likely to apply the filter to the wrong instance. There is therefore no way to use multiple instances of the same report reliably in Access. This problem does not arise with forms, so if you are interested in the technique of multiple instances, see: Managing Multiple Instances of a Form at: http://allenbrowne.com/ser-35.html For info about the Access bug: Incorrect filtering of forms and reports at: http://allenbrowne.com/bug-02.html The filter bugs that apply to forms are fixed in Access 2007. I have not yet tested if the report problems are fixed in the new version yet. If you want to test it for yourself, you can download the beta from: http://microsoft.com/office/preview/beta/ -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "???" wrote in message ... hi im trying to open the same report twice using vb code. I tried to use DoCmd.OpenReport but when i write it twice, it still opens only one instance. How can i make more instances of the same report and present them ? I used also : Dim rpt As New Report_rptOrder rpt.Visible = True but it just flashes on the screen and closes. |
#3
|
|||
|
|||
2 intances of the same report
Hi Allen,
Thank you very much for the detailed answer. The reason I want to open multiple insances is not for filtering - I'm producing an an invoice report, and I would like each time to produce a source invoice and a copy invoice. It's the same report exactly, only I need to change some captions on the reports itself ("source" / "copy" etc...) Maybe you have a better idea for this than multiple instances...? Thanks. "Allen Browne" wrote: The New keyword is the approach you have to take. But the report then depends on the variable you created. When the routine exists, the variable is cleaned up, and so the report is closed. Since this all happens very fast, you just see the report flash and disappear. You therefore need a way to manage the various instances. You can do that with a custom collection. But there is a problem. The whole point of opening multiple instances of the same report object is that you want to filter them differently. Since you are using the New keyword to generate them, there is no WhereCondition like OpenReport has, so you must programmatically set the Filter of each instance in its Open event. The trouble is that there is a bug in how Access applies the filter, so it is likely to apply the filter to the wrong instance. There is therefore no way to use multiple instances of the same report reliably in Access. This problem does not arise with forms, so if you are interested in the technique of multiple instances, see: Managing Multiple Instances of a Form at: http://allenbrowne.com/ser-35.html For info about the Access bug: Incorrect filtering of forms and reports at: http://allenbrowne.com/bug-02.html The filter bugs that apply to forms are fixed in Access 2007. I have not yet tested if the report problems are fixed in the new version yet. If you want to test it for yourself, you can download the beta from: http://microsoft.com/office/preview/beta/ -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "???" wrote in message ... hi im trying to open the same report twice using vb code. I tried to use DoCmd.OpenReport but when i write it twice, it still opens only one instance. How can i make more instances of the same report and present them ? I used also : Dim rpt As New Report_rptOrder rpt.Visible = True but it just flashes on the screen and closes. |
#4
|
|||
|
|||
2 intances of the same report
If you want 2 copies that are identical in layout, but one marked "source"
and the other marked "copy": 1. Create a table with one Text field named ReportType. Mark it as primary key. Save the table Enter 2 records, for Source and Copy. 2. Create a query using the table(s) you want for your report. Add the ReportType table as well. There must be no join between this table and the others. This will give you 2 of every recrord in your query. Save. Close 3. Open your report in design view. Set its RecordSource property to this query. In the Sorting And Grouping box (View menu), insert a line above any others, and choose the Report Type field. In the lower pane, choose Yes for the Group Header. Access puts a new section towards the top of the report design view. Add the ReportType field from the Field list (View menu) to this new section. The report will now give you 2 copies of everything: one marked Source, and the other marked Copy. In a case where you want only one, you can filter the report. If you want a triplicate copy, add a 3rd record to the table. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Nadav" wrote in message ... Hi Allen, Thank you very much for the detailed answer. The reason I want to open multiple insances is not for filtering - I'm producing an an invoice report, and I would like each time to produce a source invoice and a copy invoice. It's the same report exactly, only I need to change some captions on the reports itself ("source" / "copy" etc...) Maybe you have a better idea for this than multiple instances...? Thanks. "Allen Browne" wrote: The New keyword is the approach you have to take. But the report then depends on the variable you created. When the routine exists, the variable is cleaned up, and so the report is closed. Since this all happens very fast, you just see the report flash and disappear. You therefore need a way to manage the various instances. You can do that with a custom collection. But there is a problem. The whole point of opening multiple instances of the same report object is that you want to filter them differently. Since you are using the New keyword to generate them, there is no WhereCondition like OpenReport has, so you must programmatically set the Filter of each instance in its Open event. The trouble is that there is a bug in how Access applies the filter, so it is likely to apply the filter to the wrong instance. There is therefore no way to use multiple instances of the same report reliably in Access. This problem does not arise with forms, so if you are interested in the technique of multiple instances, see: Managing Multiple Instances of a Form at: http://allenbrowne.com/ser-35.html For info about the Access bug: Incorrect filtering of forms and reports at: http://allenbrowne.com/bug-02.html The filter bugs that apply to forms are fixed in Access 2007. I have not yet tested if the report problems are fixed in the new version yet. If you want to test it for yourself, you can download the beta from: http://microsoft.com/office/preview/beta/ "???" wrote in message ... hi im trying to open the same report twice using vb code. I tried to use DoCmd.OpenReport but when i write it twice, it still opens only one instance. How can i make more instances of the same report and present them ? I used also : Dim rpt As New Report_rptOrder rpt.Visible = True but it just flashes on the screen and closes. |
#5
|
|||
|
|||
2 intances of the same report
Allen -
Thank you very much. Nadav. "Allen Browne" wrote: If you want 2 copies that are identical in layout, but one marked "source" and the other marked "copy": 1. Create a table with one Text field named ReportType. Mark it as primary key. Save the table Enter 2 records, for Source and Copy. 2. Create a query using the table(s) you want for your report. Add the ReportType table as well. There must be no join between this table and the others. This will give you 2 of every recrord in your query. Save. Close 3. Open your report in design view. Set its RecordSource property to this query. In the Sorting And Grouping box (View menu), insert a line above any others, and choose the Report Type field. In the lower pane, choose Yes for the Group Header. Access puts a new section towards the top of the report design view. Add the ReportType field from the Field list (View menu) to this new section. The report will now give you 2 copies of everything: one marked Source, and the other marked Copy. In a case where you want only one, you can filter the report. If you want a triplicate copy, add a 3rd record to the table. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Nadav" wrote in message ... Hi Allen, Thank you very much for the detailed answer. The reason I want to open multiple insances is not for filtering - I'm producing an an invoice report, and I would like each time to produce a source invoice and a copy invoice. It's the same report exactly, only I need to change some captions on the reports itself ("source" / "copy" etc...) Maybe you have a better idea for this than multiple instances...? Thanks. "Allen Browne" wrote: The New keyword is the approach you have to take. But the report then depends on the variable you created. When the routine exists, the variable is cleaned up, and so the report is closed. Since this all happens very fast, you just see the report flash and disappear. You therefore need a way to manage the various instances. You can do that with a custom collection. But there is a problem. The whole point of opening multiple instances of the same report object is that you want to filter them differently. Since you are using the New keyword to generate them, there is no WhereCondition like OpenReport has, so you must programmatically set the Filter of each instance in its Open event. The trouble is that there is a bug in how Access applies the filter, so it is likely to apply the filter to the wrong instance. There is therefore no way to use multiple instances of the same report reliably in Access. This problem does not arise with forms, so if you are interested in the technique of multiple instances, see: Managing Multiple Instances of a Form at: http://allenbrowne.com/ser-35.html For info about the Access bug: Incorrect filtering of forms and reports at: http://allenbrowne.com/bug-02.html The filter bugs that apply to forms are fixed in Access 2007. I have not yet tested if the report problems are fixed in the new version yet. If you want to test it for yourself, you can download the beta from: http://microsoft.com/office/preview/beta/ "???" wrote in message ... hi im trying to open the same report twice using vb code. I tried to use DoCmd.OpenReport but when i write it twice, it still opens only one instance. How can i make more instances of the same report and present them ? I used also : Dim rpt As New Report_rptOrder rpt.Visible = True but it just flashes on the screen and closes. |
#6
|
|||
|
|||
2 intances of the same report
Allen,
Maybe you can tell me how to programatically change a text box's caption in a report ? i mean, on the "Open" event of the report, i'll have the code to change a caption in the report. I tried and it didn't work. (txtKind = "blabla" doesn't wotk). Thanks. "Allen Browne" wrote: If you want 2 copies that are identical in layout, but one marked "source" and the other marked "copy": 1. Create a table with one Text field named ReportType. Mark it as primary key. Save the table Enter 2 records, for Source and Copy. 2. Create a query using the table(s) you want for your report. Add the ReportType table as well. There must be no join between this table and the others. This will give you 2 of every recrord in your query. Save. Close 3. Open your report in design view. Set its RecordSource property to this query. In the Sorting And Grouping box (View menu), insert a line above any others, and choose the Report Type field. In the lower pane, choose Yes for the Group Header. Access puts a new section towards the top of the report design view. Add the ReportType field from the Field list (View menu) to this new section. The report will now give you 2 copies of everything: one marked Source, and the other marked Copy. In a case where you want only one, you can filter the report. If you want a triplicate copy, add a 3rd record to the table. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Nadav" wrote in message ... Hi Allen, Thank you very much for the detailed answer. The reason I want to open multiple insances is not for filtering - I'm producing an an invoice report, and I would like each time to produce a source invoice and a copy invoice. It's the same report exactly, only I need to change some captions on the reports itself ("source" / "copy" etc...) Maybe you have a better idea for this than multiple instances...? Thanks. "Allen Browne" wrote: The New keyword is the approach you have to take. But the report then depends on the variable you created. When the routine exists, the variable is cleaned up, and so the report is closed. Since this all happens very fast, you just see the report flash and disappear. You therefore need a way to manage the various instances. You can do that with a custom collection. But there is a problem. The whole point of opening multiple instances of the same report object is that you want to filter them differently. Since you are using the New keyword to generate them, there is no WhereCondition like OpenReport has, so you must programmatically set the Filter of each instance in its Open event. The trouble is that there is a bug in how Access applies the filter, so it is likely to apply the filter to the wrong instance. There is therefore no way to use multiple instances of the same report reliably in Access. This problem does not arise with forms, so if you are interested in the technique of multiple instances, see: Managing Multiple Instances of a Form at: http://allenbrowne.com/ser-35.html For info about the Access bug: Incorrect filtering of forms and reports at: http://allenbrowne.com/bug-02.html The filter bugs that apply to forms are fixed in Access 2007. I have not yet tested if the report problems are fixed in the new version yet. If you want to test it for yourself, you can download the beta from: http://microsoft.com/office/preview/beta/ "???" wrote in message ... hi im trying to open the same report twice using vb code. I tried to use DoCmd.OpenReport but when i write it twice, it still opens only one instance. How can i make more instances of the same report and present them ? I used also : Dim rpt As New Report_rptOrder rpt.Visible = True but it just flashes on the screen and closes. |
#7
|
|||
|
|||
2 intances of the same report
From memory, Report_Open is too early to assign a value to an unbound
control. Try the Format event of the section the control is in. Alternatively, right-click the text box in design view, and Change To | Label. In Report_Open, you will can set the Caption of a label, e.g.: Me.[Label1].Caption = "blabla" -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Nadav" wrote in message ... Allen, Maybe you can tell me how to programatically change a text box's caption in a report ? i mean, on the "Open" event of the report, i'll have the code to change a caption in the report. I tried and it didn't work. (txtKind = "blabla" doesn't wotk). Thanks. "Allen Browne" wrote: If you want 2 copies that are identical in layout, but one marked "source" and the other marked "copy": 1. Create a table with one Text field named ReportType. Mark it as primary key. Save the table Enter 2 records, for Source and Copy. 2. Create a query using the table(s) you want for your report. Add the ReportType table as well. There must be no join between this table and the others. This will give you 2 of every recrord in your query. Save. Close 3. Open your report in design view. Set its RecordSource property to this query. In the Sorting And Grouping box (View menu), insert a line above any others, and choose the Report Type field. In the lower pane, choose Yes for the Group Header. Access puts a new section towards the top of the report design view. Add the ReportType field from the Field list (View menu) to this new section. The report will now give you 2 copies of everything: one marked Source, and the other marked Copy. In a case where you want only one, you can filter the report. If you want a triplicate copy, add a 3rd record to the table. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Nadav" wrote in message ... Hi Allen, Thank you very much for the detailed answer. The reason I want to open multiple insances is not for filtering - I'm producing an an invoice report, and I would like each time to produce a source invoice and a copy invoice. It's the same report exactly, only I need to change some captions on the reports itself ("source" / "copy" etc...) Maybe you have a better idea for this than multiple instances...? Thanks. "Allen Browne" wrote: The New keyword is the approach you have to take. But the report then depends on the variable you created. When the routine exists, the variable is cleaned up, and so the report is closed. Since this all happens very fast, you just see the report flash and disappear. You therefore need a way to manage the various instances. You can do that with a custom collection. But there is a problem. The whole point of opening multiple instances of the same report object is that you want to filter them differently. Since you are using the New keyword to generate them, there is no WhereCondition like OpenReport has, so you must programmatically set the Filter of each instance in its Open event. The trouble is that there is a bug in how Access applies the filter, so it is likely to apply the filter to the wrong instance. There is therefore no way to use multiple instances of the same report reliably in Access. This problem does not arise with forms, so if you are interested in the technique of multiple instances, see: Managing Multiple Instances of a Form at: http://allenbrowne.com/ser-35.html For info about the Access bug: Incorrect filtering of forms and reports at: http://allenbrowne.com/bug-02.html The filter bugs that apply to forms are fixed in Access 2007. I have not yet tested if the report problems are fixed in the new version yet. If you want to test it for yourself, you can download the beta from: http://microsoft.com/office/preview/beta/ "???" wrote in message ... hi im trying to open the same report twice using vb code. I tried to use DoCmd.OpenReport but when i write it twice, it still opens only one instance. How can i make more instances of the same report and present them ? I used also : Dim rpt As New Report_rptOrder rpt.Visible = True but it just flashes on the screen and closes. |
#8
|
|||
|
|||
2 intances of the same report
Allen,
Thanks man, u'r a big help. btw - the Caption property for some reason doesn't appear in the AutoComplete, you know, when u hit "." after the control's name. I tried the same code only with "Text" instead of "Caption", who also doesn't appear there... and it failed. but u'rs is working... so thanks u. Nadav. "Allen Browne" wrote: From memory, Report_Open is too early to assign a value to an unbound control. Try the Format event of the section the control is in. Alternatively, right-click the text box in design view, and Change To | Label. In Report_Open, you will can set the Caption of a label, e.g.: Me.[Label1].Caption = "blabla" -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Nadav" wrote in message ... Allen, Maybe you can tell me how to programatically change a text box's caption in a report ? i mean, on the "Open" event of the report, i'll have the code to change a caption in the report. I tried and it didn't work. (txtKind = "blabla" doesn't wotk). Thanks. "Allen Browne" wrote: If you want 2 copies that are identical in layout, but one marked "source" and the other marked "copy": 1. Create a table with one Text field named ReportType. Mark it as primary key. Save the table Enter 2 records, for Source and Copy. 2. Create a query using the table(s) you want for your report. Add the ReportType table as well. There must be no join between this table and the others. This will give you 2 of every recrord in your query. Save. Close 3. Open your report in design view. Set its RecordSource property to this query. In the Sorting And Grouping box (View menu), insert a line above any others, and choose the Report Type field. In the lower pane, choose Yes for the Group Header. Access puts a new section towards the top of the report design view. Add the ReportType field from the Field list (View menu) to this new section. The report will now give you 2 copies of everything: one marked Source, and the other marked Copy. In a case where you want only one, you can filter the report. If you want a triplicate copy, add a 3rd record to the table. -- Allen Browne - Microsoft MVP. Perth, Western Australia. Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Nadav" wrote in message ... Hi Allen, Thank you very much for the detailed answer. The reason I want to open multiple insances is not for filtering - I'm producing an an invoice report, and I would like each time to produce a source invoice and a copy invoice. It's the same report exactly, only I need to change some captions on the reports itself ("source" / "copy" etc...) Maybe you have a better idea for this than multiple instances...? Thanks. "Allen Browne" wrote: The New keyword is the approach you have to take. But the report then depends on the variable you created. When the routine exists, the variable is cleaned up, and so the report is closed. Since this all happens very fast, you just see the report flash and disappear. You therefore need a way to manage the various instances. You can do that with a custom collection. But there is a problem. The whole point of opening multiple instances of the same report object is that you want to filter them differently. Since you are using the New keyword to generate them, there is no WhereCondition like OpenReport has, so you must programmatically set the Filter of each instance in its Open event. The trouble is that there is a bug in how Access applies the filter, so it is likely to apply the filter to the wrong instance. There is therefore no way to use multiple instances of the same report reliably in Access. This problem does not arise with forms, so if you are interested in the technique of multiple instances, see: Managing Multiple Instances of a Form at: http://allenbrowne.com/ser-35.html For info about the Access bug: Incorrect filtering of forms and reports at: http://allenbrowne.com/bug-02.html The filter bugs that apply to forms are fixed in Access 2007. I have not yet tested if the report problems are fixed in the new version yet. If you want to test it for yourself, you can download the beta from: http://microsoft.com/office/preview/beta/ "???" wrote in message ... hi im trying to open the same report twice using vb code. I tried to use DoCmd.OpenReport but when i write it twice, it still opens only one instance. How can i make more instances of the same report and present them ? I used also : Dim rpt As New Report_rptOrder rpt.Visible = True but it just flashes on the screen and closes. |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Parameter thru Form Dialog Box for REPORT | Sandy | Setting Up & Running Reports | 16 | January 10th, 2006 10:06 AM |
subreport not displaying in main report | JohnLute | Setting Up & Running Reports | 15 | November 17th, 2005 04:02 PM |
To Sharkbyte and all: Calculate a total values in group level | Ally | General Discussion | 6 | June 13th, 2005 08:16 PM |
Save Report With CreateReport Coding Issue | Jeff Conrad | Setting Up & Running Reports | 8 | July 12th, 2004 08:39 AM |
Label | SRIT | General Discussion | 2 | June 22nd, 2004 09:42 PM |