(This is a crosspost from .data for greater exposure)
I am writing an external app that utilizes. The app needs to be able to run
repeatedly, but I am having a problem because Access will not close. When
..Quit is called, it pops up a blank Access window, which will not close by
normal means, only by ending the process in Task Manager. Oddly enough, the
first time that this is run after a reboot, it works fine, but every time
after that, it will not close.
Here is the applicable Access code, in VB.NET:
Dim appAcc As New Access.Application
appAcc.Visible = False
appAcc.OpenCurrentDatabase(dbname, True)
appAcc.DoCmd.DeleteObject(acTable, "ArcSumm")
appAcc.DoCmd.DeleteObject(acTable, "zip_table")
appAcc.DoCmd.DeleteObject(acTable, "ArcCover")
appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum, acTable,
"ArcSumm", "ArcSumm")
appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum, acTable,
"ArcCover", "ArcCover")
appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum, acTable,
"ArcZips", "zip_table")
appAcc.DoCmd.RunMacro("webCover")
Dim summ As DAO.Recordset
summ = appAcc.CurrentDb.OpenRecordset("ArcSumm")
If summ.RecordCount = 0 Then
appAcc.DoCmd.RunMacro("DoEverythingWebNoHaz")
Else
appAcc.DoCmd.RunMacro("DoEverythingWeb")
End If
summ.Close()
summ = Nothing
appAcc.DoCmd.OpenReport("Definitions", Access.AcView.acViewNormal) 'dummy
report to flush the pdf file
appAcc.DoCmd.Close(acReport, "Definitions", Access.AcCloseSave.acSaveNo)
appAcc.CloseCurrentDatabase()
appAcc.Quit(Access.AcQuitOption.acQuitSaveNone)
appAcc = Nothing
I have tried to ensure that everything is closed out, and yet it persist in
popping up the Access window. If I try to run the app again, it fails
because it cannot access the database.
Can anyone advise me what to do? 3 2422
Hi,
Marshal.ReleaseComObject(appAcc)
GC.Collect
Ken
--------------------------
"Rob Hughes" wrote: (This is a crosspost from .data for greater exposure)
I am writing an external app that utilizes. The app needs to be able to run repeatedly, but I am having a problem because Access will not close. When ..Quit is called, it pops up a blank Access window, which will not close by normal means, only by ending the process in Task Manager. Oddly enough, the first time that this is run after a reboot, it works fine, but every time after that, it will not close.
Here is the applicable Access code, in VB.NET:
Dim appAcc As New Access.Application appAcc.Visible = False appAcc.OpenCurrentDatabase(dbname, True) appAcc.DoCmd.DeleteObject(acTable, "ArcSumm") appAcc.DoCmd.DeleteObject(acTable, "zip_table") appAcc.DoCmd.DeleteObject(acTable, "ArcCover") appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum, acTable, "ArcSumm", "ArcSumm") appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum, acTable, "ArcCover", "ArcCover") appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum, acTable, "ArcZips", "zip_table") appAcc.DoCmd.RunMacro("webCover") Dim summ As DAO.Recordset summ = appAcc.CurrentDb.OpenRecordset("ArcSumm") If summ.RecordCount = 0 Then appAcc.DoCmd.RunMacro("DoEverythingWebNoHaz") Else appAcc.DoCmd.RunMacro("DoEverythingWeb") End If summ.Close() summ = Nothing appAcc.DoCmd.OpenReport("Definitions", Access.AcView.acViewNormal) 'dummy report to flush the pdf file appAcc.DoCmd.Close(acReport, "Definitions", Access.AcCloseSave.acSaveNo) appAcc.CloseCurrentDatabase() appAcc.Quit(Access.AcQuitOption.acQuitSaveNone) appAcc = Nothing
I have tried to ensure that everything is closed out, and yet it persist in popping up the Access window. If I try to run the app again, it fails because it cannot access the database.
Can anyone advise me what to do?
Excellent, thank you.
As a learning .NET programmer, I'm still picking up on certain practices. Is
it a good idea to finish off all programs with a GC.Collect? That was one of
the things that I just assumed it did automatically.
"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com... Hi,
Marshal.ReleaseComObject(appAcc) GC.Collect
Ken -------------------------- "Rob Hughes" wrote:
(This is a crosspost from .data for greater exposure)
I am writing an external app that utilizes. The app needs to be able to
run repeatedly, but I am having a problem because Access will not close.
When ..Quit is called, it pops up a blank Access window, which will not close
by normal means, only by ending the process in Task Manager. Oddly enough,
the first time that this is run after a reboot, it works fine, but every
time after that, it will not close.
Here is the applicable Access code, in VB.NET:
Dim appAcc As New Access.Application appAcc.Visible = False appAcc.OpenCurrentDatabase(dbname, True) appAcc.DoCmd.DeleteObject(acTable, "ArcSumm") appAcc.DoCmd.DeleteObject(acTable, "zip_table") appAcc.DoCmd.DeleteObject(acTable, "ArcCover") appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum,
acTable, "ArcSumm", "ArcSumm") appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum,
acTable, "ArcCover", "ArcCover") appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum,
acTable, "ArcZips", "zip_table") appAcc.DoCmd.RunMacro("webCover") Dim summ As DAO.Recordset summ = appAcc.CurrentDb.OpenRecordset("ArcSumm") If summ.RecordCount = 0 Then appAcc.DoCmd.RunMacro("DoEverythingWebNoHaz") Else appAcc.DoCmd.RunMacro("DoEverythingWeb") End If summ.Close() summ = Nothing appAcc.DoCmd.OpenReport("Definitions", Access.AcView.acViewNormal)
'dummy report to flush the pdf file appAcc.DoCmd.Close(acReport, "Definitions", Access.AcCloseSave.acSaveNo) appAcc.CloseCurrentDatabase() appAcc.Quit(Access.AcQuitOption.acQuitSaveNone) appAcc = Nothing
I have tried to ensure that everything is closed out, and yet it persist
in popping up the Access window. If I try to run the app again, it fails because it cannot access the database.
Can anyone advise me what to do?
Hi,
You dont have to. When you use marshal.releasecomobject the
object is freed the next time the garbage collector collects the garbage.
This will happen automatically but I wanted to run right away and release
access.
Ken
--------------------
"Rob Hughes" <ro*******@aaidataTHIS.com> wrote in message
news:uF**************@tk2msftngp13.phx.gbl...
Excellent, thank you.
As a learning .NET programmer, I'm still picking up on certain practices. Is
it a good idea to finish off all programs with a GC.Collect? That was one of
the things that I just assumed it did automatically.
"Ken Tucker [MVP]" <Ke**********@discussions.microsoft.com> wrote in message
news:F7**********************************@microsof t.com... Hi,
Marshal.ReleaseComObject(appAcc) GC.Collect
Ken -------------------------- "Rob Hughes" wrote:
(This is a crosspost from .data for greater exposure)
I am writing an external app that utilizes. The app needs to be able to
run repeatedly, but I am having a problem because Access will not close.
When ..Quit is called, it pops up a blank Access window, which will not close
by normal means, only by ending the process in Task Manager. Oddly enough,
the first time that this is run after a reboot, it works fine, but every
time after that, it will not close.
Here is the applicable Access code, in VB.NET:
Dim appAcc As New Access.Application appAcc.Visible = False appAcc.OpenCurrentDatabase(dbname, True) appAcc.DoCmd.DeleteObject(acTable, "ArcSumm") appAcc.DoCmd.DeleteObject(acTable, "zip_table") appAcc.DoCmd.DeleteObject(acTable, "ArcCover") appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum,
acTable, "ArcSumm", "ArcSumm") appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum,
acTable, "ArcCover", "ArcCover") appAcc.DoCmd.TransferDatabase(acImport, "dBase 5.0", dbloc + pnum,
acTable, "ArcZips", "zip_table") appAcc.DoCmd.RunMacro("webCover") Dim summ As DAO.Recordset summ = appAcc.CurrentDb.OpenRecordset("ArcSumm") If summ.RecordCount = 0 Then appAcc.DoCmd.RunMacro("DoEverythingWebNoHaz") Else appAcc.DoCmd.RunMacro("DoEverythingWeb") End If summ.Close() summ = Nothing appAcc.DoCmd.OpenReport("Definitions", Access.AcView.acViewNormal)
'dummy report to flush the pdf file appAcc.DoCmd.Close(acReport, "Definitions", Access.AcCloseSave.acSaveNo) appAcc.CloseCurrentDatabase() appAcc.Quit(Access.AcQuitOption.acQuitSaveNone) appAcc = Nothing
I have tried to ensure that everything is closed out, and yet it persist
in popping up the Access window. If I try to run the app again, it fails because it cannot access the database.
Can anyone advise me what to do? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: salih ataoz |
last post by:
i close a form and i want to open it again it show me
Cannot access a disposed object
at vb6 this is ok
at comman1_click
form1.show
|
by: Ronny Sigo |
last post by:
Hello all,
I have to open a readonly Excel sheet from clicking on a button on an access
form. So far no problem:
Dim ObjXL As Excel.Application...
|
by: Lumpierbritches |
last post by:
Thank you in advance for any and all assistance. It is greatly appreciated.
I would like to know if there's a way to programatically close any...
|
by: AA |
last post by:
This is making me crazy!!
Please, if some body can help me.
I'm testing a ver simple socket client.
In my test I just open and close a...
|
by: Ashish |
last post by:
hi all,
i am just curious as to how to access the SessionState section in
web.config file programatically and then to possibly change it , are...
|
by: Amjad |
last post by:
Hi,
I just wrote a test Windows Service that creates a text file on startup
(please see my code below). The file is never created.
Protected...
|
by: Antonio Dias |
last post by:
Hi all,
I'm hoping someone can help me with this question:
I'm building a winforms .net application which is going to use a web
service with...
|
by: JohnR |
last post by:
When creating an msAccess db within the Access UI itself the fields that are
text are NOT padded with blanks. For example, if I have a 10 char...
|
by: Robert Waggoner |
last post by:
When I close my access 97 application, sometimes the access "shell" remains
open and minimized at the bottom of the screen. What can I do...
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: teenabhardwaj |
last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: Carina712 |
last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
| |