I have a windows service that uses office xp automation. Here is the
code
---------------------------------------
Public Sub CAccessSnapShot ()
Try
Dim objAccess As New Access.Applicat ion()
Dim vSQLText, vThreadName As String
Try
vThreadName = Thread.CurrentT hread.Name
cFunctions.Writ eEventLog("star ting report on thread: "
& pDBType)
Dim dtSQLText As DataTable
' GET THE SQL ASSOCIATED WITH THIS REPORT
dtSQLText = cFunctions.GetS QL(pReportRefNu m,
pQConnectionStr ing)
vSQLText = CStr(dtSQLText. Rows(0).Item("S QLText"))
Dim strMDBName, strSNPName, strAccessFuncNm As String
' GET THE NAME OF THE TEMPORARY MDB AND MAKE A COPY
TO WORK WITH
strMDBName = cFunctions.GetN ewFileName(".md b")
strMDBPath = pInputFileDir + strMDBName
System.IO.File. Copy(pInputFile Dir + pInputFileName,
pInputFileDir + strMDBName)
' OPEN THE NEW COPY OF THE MDB
objAccess.OpenC urrentDatabase( pInputFileDir +
strMDBName)
' GET THE NEW NAME OF THE SNAP FILE
strSNPName = cFunctions.GetN ewFileName(".sn p")
strAccessFuncNm = "rpt" + pReportName
' RUN THE FUNCTION FROM ACCESS TO CREATE THE REPORT
SNAPSHOT
objAccess.Run(" RunReports", pReportName, vSQLText,
pOutputFileDir, strSNPName, pConnectString)
' SHUT DOWN ACCESS AND RELEASE THE COPY FROM MEMORY
objAccess.DoCmd ().Quit(Access. AcQuitOption.ac QuitSaveNone)
' ------
System.Runtime. InteropServices .Marshal.Releas eComObject(objA ccess)
' UPDATE THE QUEUE WITH THE SNAP SHOT NAME AND DELETE
THE COPY OF THE MDB
cFunctions.Writ eEventLog("comp lete report on thread: "
& vThreadName)
cFunctions.Upda teRptComplete(p ReportRefNum,
strSNPName, pQConnectionStr ing)
System.IO.File. Delete(strMDBPa th)
'RaiseEvent ThreadDone(pDBT ype)
Catch errorVariable As Exception
'Error trapping
cFunctions.Upda teReportError(p ReportRefNum,
errorVariable.M essage.ToString , pQConnectionStr ing)
cFunctions.Writ eEventLog("GPRe portServer.NET-Error: "
& errorVariable.M essage.ToString )
objAccess.DoCmd ().Quit(Access. AcQuitOption.ac QuitSaveNone)
' -----
System.Runtime. InteropServices .Marshal.Releas eComObject(objA ccess)
Finally
RaiseEvent ThreadDone(pDBT ype, vThreadName)
End Try
'CType(state, AutoResetEvent) .Set()
Catch
Catch errorVariable As Exception
'Error trapping
cFunctions.Upda teReportError(p ReportRefNum,
errorVariable.M essage.ToString , pQConnectionStr ing)
cFunctions.Writ eEventLog("GPRe portServer.NET-Error: " &
errorVariable.M essage.ToString )
End Try
End Sub
-----------------------------------------------------
I have a driver sub routine that creates a set of threads. Then on
each tread it calls this sub if there is a request for an access
report. He problem is if 2 or more threads are running at the same
time, when the first thread ends and issues the quit, it seems to
affect all instances of access in memory. The all stop running. How
can I issue the quit to just the thread this sub is running on??? 1 1287
* st******@gapac. com (Steven Thomas) scripsit:
[...]
Double post.
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: BJ |
last post by:
The application I have been developing is great except one flaw. When
Windows NT shuts down, it doesn't send the Event to my application (if it
did, it would close all of the open forms and kill an activity flag I create
on launch) and an error comes up that says "Cannot Quit". I have no idea
where this error is coming from as I did put it in there.
I am unsure if this is because of the hidden form which has a bunch of
timers on it (I...
|
by: Lauren Quantrell |
last post by:
Running Access2000 ADP Project/MSDE on Windows XP...
- I Open my Access ADP project.
In the Windows Task Manager Processes window MSACCESS.EXE shows
up.
- I don't do anything else in Access.
- I click a toolbar button that executes the code: application.quit in
a module in my Acesss project.
- My Access project closes.
Now there are TWO instances of MSACCESS.EXE showing up in the
Windows Task Manager Processes window, my cursor is...
|
by: downwitch |
last post by:
Greetings,
I have an application which has recently gone from being one big piece
of front-end code to being three, i.e. an mdb A that references an mda
B and an mda C. (For what it's worth, in the interest of complete
disclosure, mda B also references mda C).
This application has always closed in the mvps time-honored method of
calling Application.Quit on the Unload event of the switchboard.
|
by: rdemyan via AccessMonster.com |
last post by:
I have a forced logoff routine in place that works well unless an Access
messagebox is showing in the front-end that the routine is trying to shut
down. It doesn't work use Access commands to shut down the application.
Is there a way to use a Windows API to shutdown the application? I'm hoping
that, like the task manager, a Windows API shutdown would work even if a
modal form is displayed in the application it is trying to shutdown.
...
|
by: Henry Stockbridge |
last post by:
Hi,
I have a combo box on a form whose purpose is to add a record to the
form's underlying table. There are several (16) fields that the combo
box carries with it, only a few that are visible to the User. When the
User selects a value from the combo box, the application shuts down.
Here is the code for the combo box that may lead to the problem.
==============================================
Private Sub cboAddPhysician_AfterUpdate()...
| |
by: rdemyan via AccessMonster.com |
last post by:
Sometimes users (including myself) accidentally click on the application
close icon in the application menu bar when they meant to just click on the
'X' for the form. Of course the app closes and this is very annoying.
So, I added a messagebox to my hidden StartAppForm in the Unload event. Now
when the application closes the user is presented with a message so they can
abort closing in case they don't really want to close. This has been...
|
by: mdmdmd |
last post by:
Hello,
I wish to collect 4 files from a user. So I have decided to use
tkFileDialog askopenfilename. My problem is that after a few file
selections the root window is destroyed (the whole program just dissappears)
I have created a simple example and was able to reproduce the same thing
with this. I've just started using tkinter so I have no idea what I may
be doing wrong. If anyone has any ideas please let me know.
|
by: teddysnips |
last post by:
This is sort of an addendum to my previous post entitled: "Restrict FE
application to one user at a time".
My preferred design is to have a table with a single row that contains
the network name of the person currently connected to the database.
The existence of the row will serve a) to allow the system to bump any
other user who wishes to connect, and b) to inform such users of the
name of the currently logged-on user.
However, at...
|
by: Cramer |
last post by:
I'm running XP Pro/SP2 + patches and updates, with Visual Studio
Professional 2008 (and no prior installation of Visual Studio ever
installed).
When attempting to open an ASP.NET Web application project, Visual Studio
shuts down immediately and with no error message. I can open Visual Studio -
but when subsequently attempting to open the project, Visual Studio
immediately shuts down.
More specifically:
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |