Hi, Add this after ac= nothing . System.Runtime.InteropServices.Marshal.ReleaseComObject(ac) Ken ----------------- [quoted text, click to view] "Dougal Fair" <dougal@dougalfair.com> wrote in message news:40008e24.160197265@news.goldengate.net... > Hello, > > I have written a vb.net program that invokes an Access2000 report in > Preview mode, so that it shows on the screen. My program then goes on > its merry way and the user can read the report and close it at his > leisure. > > My problem is: when I run this on Win2000 and watch it with the Task > Manager, I see it create a task for MSACCESS.EXE for the report. But > when the user closes the report, the task does not always disappear > from the Task Manager (sometimes it does). > > When it hangs around, then I can't double-click on an Acess2000 MDB > database file in Windows Explorer so as to open the database. > Apparently the existing instance of the MSACCESS.EXE task gets in the > way. > > If I close the dialog from which I launched the Acess2000 report, > sometimes that causes the MSACCESS.EXE task to go away, but frequently > it does not. If I close the VB program itself, that usually kills the > MSACCESS.EXE taks, but not always. Sometimes, if I repetedly invoke > reports from my program (for different customer records), I can get > multiple MSACCESS.EXE tasks going, and even though I close the > Access2000 report windows and exit the VB program, the MSACCESS.EXE > tasks remain, and the only way I can get rid of them is to kill them > from within the Task Manager. > > > I thought this was because of how .NET doesn't actually release memory > even though you have closed and disposed of the objects that used the > resources, but how do I force the resources to be released? > > > Here is the code I use to invoke the reports: > > > > Public Sub PreviewInvoice() > > Dim ac As New Access.Application > > ac.OpenCurrentDatabase(oApp.DatabaseFileName) > > ac.DoCmd.OpenReport("03Invoice", Access.AcView.acViewPreview, > "qry03InvoiceQuery", "[BillingEntityID]=" & Me.ID) > > ac.Visible = True > ac.DoCmd.Maximize() > > ac = Nothing > > End Sub > > > > Can anybody provide me with a clue here? > > TIA > > > > >
Hello, I have written a vb.net program that invokes an Access2000 report in Preview mode, so that it shows on the screen. My program then goes on its merry way and the user can read the report and close it at his leisure. My problem is: when I run this on Win2000 and watch it with the Task Manager, I see it create a task for MSACCESS.EXE for the report. But when the user closes the report, the task does not always disappear from the Task Manager (sometimes it does). When it hangs around, then I can't double-click on an Acess2000 MDB database file in Windows Explorer so as to open the database. Apparently the existing instance of the MSACCESS.EXE task gets in the way. If I close the dialog from which I launched the Acess2000 report, sometimes that causes the MSACCESS.EXE task to go away, but frequently it does not. If I close the VB program itself, that usually kills the MSACCESS.EXE taks, but not always. Sometimes, if I repetedly invoke reports from my program (for different customer records), I can get multiple MSACCESS.EXE tasks going, and even though I close the Access2000 report windows and exit the VB program, the MSACCESS.EXE tasks remain, and the only way I can get rid of them is to kill them from within the Task Manager. I thought this was because of how .NET doesn't actually release memory even though you have closed and disposed of the objects that used the resources, but how do I force the resources to be released? Here is the code I use to invoke the reports: Public Sub PreviewInvoice() Dim ac As New Access.Application ac.OpenCurrentDatabase(oApp.DatabaseFileName) ac.DoCmd.OpenReport("03Invoice", Access.AcView.acViewPreview, "qry03InvoiceQuery", "[BillingEntityID]=" & Me.ID) ac.Visible = True ac.DoCmd.Maximize() ac = Nothing End Sub Can anybody provide me with a clue here? TIA
* dougal@dougalfair.com (Dougal Fair) scripsit: [quoted text, click to view] > I have written a vb.net program that invokes an Access2000 report in > Preview mode, so that it shows on the screen. My program then goes on > its merry way and the user can read the report and close it at his > leisure. > > My problem is: when I run this on Win2000 and watch it with the Task > Manager, I see it create a task for MSACCESS.EXE for the report. But > when the user closes the report, the task does not always disappear > from the Task Manager (sometimes it does).
< http://support.microsoft.com/default.aspx?scid=kb;en-us;317109> -- Herfried K. Wagner [MVP]
On Sat, 10 Jan 2004 19:53:03 -0500, "Ken Tucker [MVP]" [quoted text, click to view] <vb2ae@bellsouth.net> wrote: >Hi, > > Add this after ac= nothing . >System.Runtime.InteropServices.Marshal.ReleaseComObject(ac) > >Ken
Thank you very much - that did the trick. Except that when I added that line *after* the ac=nothing it complained about ac not being set to any object. So I moved the line to just *before* the ac=nothing statement and then it appears to work fine. Again, thanks much - it was not at ALL obvious to me how to do that. [quoted text, click to view] >----------------- >"Dougal Fair" <dougal@dougalfair.com> wrote in message >news:40008e24.160197265@news.goldengate.net... >> Hello, >> >> I have written a vb.net program that invokes an Access2000 report in >> Preview mode, so that it shows on the screen. My program then goes on >> its merry way and the user can read the report and close it at his >> leisure. >> >> My problem is: when I run this on Win2000 and watch it with the Task >> Manager, I see it create a task for MSACCESS.EXE for the report. But >> when the user closes the report, the task does not always disappear >> from the Task Manager (sometimes it does). >> >> When it hangs around, then I can't double-click on an Acess2000 MDB >> database file in Windows Explorer so as to open the database. >> Apparently the existing instance of the MSACCESS.EXE task gets in the >> way. >> >> If I close the dialog from which I launched the Acess2000 report, >> sometimes that causes the MSACCESS.EXE task to go away, but frequently >> it does not. If I close the VB program itself, that usually kills the >> MSACCESS.EXE taks, but not always. Sometimes, if I repetedly invoke >> reports from my program (for different customer records), I can get >> multiple MSACCESS.EXE tasks going, and even though I close the >> Access2000 report windows and exit the VB program, the MSACCESS.EXE >> tasks remain, and the only way I can get rid of them is to kill them >> from within the Task Manager. >> >> >> I thought this was because of how .NET doesn't actually release memory >> even though you have closed and disposed of the objects that used the >> resources, but how do I force the resources to be released? >> >> >> Here is the code I use to invoke the reports: >> >> >> >> Public Sub PreviewInvoice() >> >> Dim ac As New Access.Application >> >> ac.OpenCurrentDatabase(oApp.DatabaseFileName) >> >> ac.DoCmd.OpenReport("03Invoice", Access.AcView.acViewPreview, >> "qry03InvoiceQuery", "[BillingEntityID]=" & Me.ID) >> >> ac.Visible = True >> ac.DoCmd.Maximize() >> >> ac = Nothing >> >> End Sub >> >> >> >> Can anybody provide me with a clue here? >> >> TIA >> >> >> >> >> > >
On 11 Jan 2004 02:29:21 +0100, hirf-spam-me-here@gmx.at (Herfried K. [quoted text, click to view] Wagner [MVP]) wrote: >* dougal@dougalfair.com (Dougal Fair) scripsit: >> I have written a vb.net program that invokes an Access2000 report in >> Preview mode, so that it shows on the screen. My program then goes on >> its merry way and the user can read the report and close it at his >> leisure. >> >> My problem is: when I run this on Win2000 and watch it with the Task >> Manager, I see it create a task for MSACCESS.EXE for the report. But >> when the user closes the report, the task does not always disappear >> from the Task Manager (sometimes it does). > >< http://support.microsoft.com/default.aspx?scid=kb;en-us;317109> > >-- >Herfried K. Wagner [MVP] >< http://www.mvps.org/dotnet> Thanks very much - that was exactly what I needed. Usenet is such a wonderful thing. Cheers to the MVP's !
FWIW, you don't need the ac=nothing statement. -- Mary MCW Technologies http://www.mcwtech.com On Sun, 11 Jan 2004 06:54:54 GMT, dougal@dougalfair.com (Dougal Fair) [quoted text, click to view] wrote: >On Sat, 10 Jan 2004 19:53:03 -0500, "Ken Tucker [MVP]" ><vb2ae@bellsouth.net> wrote: > >>Hi, >> >> Add this after ac= nothing . >>System.Runtime.InteropServices.Marshal.ReleaseComObject(ac) >> >>Ken > >Thank you very much - that did the trick. Except that when I added >that line *after* the ac=nothing it complained about ac not being set >to any object. So I moved the line to just *before* the ac=nothing >statement and then it appears to work fine. > >Again, thanks much - it was not at ALL obvious to me how to do that. > > > > >>----------------- >>"Dougal Fair" <dougal@dougalfair.com> wrote in message >>news:40008e24.160197265@news.goldengate.net... >>> Hello, >>> >>> I have written a vb.net program that invokes an Access2000 report in >>> Preview mode, so that it shows on the screen. My program then goes on >>> its merry way and the user can read the report and close it at his >>> leisure. >>> >>> My problem is: when I run this on Win2000 and watch it with the Task >>> Manager, I see it create a task for MSACCESS.EXE for the report. But >>> when the user closes the report, the task does not always disappear >>> from the Task Manager (sometimes it does). >>> >>> When it hangs around, then I can't double-click on an Acess2000 MDB >>> database file in Windows Explorer so as to open the database. >>> Apparently the existing instance of the MSACCESS.EXE task gets in the >>> way. >>> >>> If I close the dialog from which I launched the Acess2000 report, >>> sometimes that causes the MSACCESS.EXE task to go away, but frequently >>> it does not. If I close the VB program itself, that usually kills the >>> MSACCESS.EXE taks, but not always. Sometimes, if I repetedly invoke >>> reports from my program (for different customer records), I can get >>> multiple MSACCESS.EXE tasks going, and even though I close the >>> Access2000 report windows and exit the VB program, the MSACCESS.EXE >>> tasks remain, and the only way I can get rid of them is to kill them >>> from within the Task Manager. >>> >>> >>> I thought this was because of how .NET doesn't actually release memory >>> even though you have closed and disposed of the objects that used the >>> resources, but how do I force the resources to be released? >>> >>> >>> Here is the code I use to invoke the reports: >>> >>> >>> >>> Public Sub PreviewInvoice() >>> >>> Dim ac As New Access.Application >>> >>> ac.OpenCurrentDatabase(oApp.DatabaseFileName) >>> >>> ac.DoCmd.OpenReport("03Invoice", Access.AcView.acViewPreview, >>> "qry03InvoiceQuery", "[BillingEntityID]=" & Me.ID) >>> >>> ac.Visible = True >>> ac.DoCmd.Maximize() >>> >>> ac = Nothing >>> >>> End Sub >>> >>> >>> >>> Can anybody provide me with a clue here? >>> >>> TIA >>> >>> >>> >>> >>> >> >>
Don't see what you're looking for? Try a search.
|