Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

a4wvba.exe not ending after macro closes

Status
Not open for further replies.

wardo2

Programmer
Apr 30, 2003
16
CA
Hi, I'm looking for some help with a problem I'm having with a custom macro. I'm running ACCPAC Corp. Edtn v 5.0 with Pervasive 2000i sp4, and I've written a custom macro that accesses the database tables using ADO. The macro works fine, but the problem I am having is on the workstations and is that once I close the macro, the A4WVBA.exe process persists in the background, and when users go to log off the client, they get errors about programs not responding (the A4WVBA.exe program), and they have to manually end it. This is a problem related to the ADO access, since if I remove this code it does not cause the problem. Unfortunately, I need to use ADO as I am accessing custom tables also. Has anyone ever run into this issue, and if so, do they have a fix.

Thanks
 
You could switch to the COMAPI, it is designed for use within Accpac. Otherwise, you may a left an ADO connection or recordset open. Or not properlt disposed of the objects.

If you know which code is causing the problems, then post it and we'll have a look.

Thanks and Good Luck!

zemp
 
Hi Zemp, thanks for the quick response....I think I have closed all the recordsets (recordset.close) and destroyed them (Set recordset = nothing), as well as closed an destroyed the ADO connection object, but I will go through the code to be sure. As far as the code, the following is the code that declares and sets the connection object. I am using a global variable called adoConn to represent the connection as I want to be able to use the connection throughout the macro.

As for using the COMAPI, unfortunately I don't believe that I can use this as I am accessing custom tables that I myself have created to store information ACCPAC does not track, so I think I am stuck with using ADO.

Anyway, here is the code snippet:

------------------------------------------------------
In the general declarations:
Global adoconn As ADODB.Connection

In the MainSub() sub:

Set adoconn = New ADODB.Connection
adoconn.Open "driver={Pervasive ODBC Client Interface};ServerName=myserver;DBQ=mydatabase", "ADMIN", ""

If adoconn.State <> adStateOpen Then
MsgBox &quot;Error connecting to SerumDepot Database.&quot;
Else
MaintainContracts.Show
End If

adoconn.Close
Set adoconn = Nothing

---------------------------------------------------------

The really strange part is it works fine on the standalone installation on my laptop, but when I move it to the development environment, which is a Metaframe client connecting to an &quot;ACCPAC&quot; server, that is where it doesn't work.

Thanks for the help
 
As another piece of information, if I open the macro using the VBA editor from ACCPAC and run the macro from there, the problem does not occur even on the dev. environment. It seems as though it is limited to running the macro from the ACCPAC interface.
 
So you are not actually connection with Accpac but rather your own tables/database. However, from the sound of it your problem is macro or environment related and not Accpac related. I would check to see that the mdac (ADO) version is that same on all machines involved. Also check your code to see if your macro is actually ending or if is it just hidden and still sitting there (running in the background)?

Thanks and Good Luck!

zemp
 
Thanks Zemp, I'll check on the mdac. I am using the ACCPAC desktop to launch the macro I created using the ACCPAC macro/VBA utility, so it still may be ACCPAC related since it works fine when I run it from within the VBA. As for the tables, I just created new ones in the same database as the ACCPAC tables.

A quick question....how do I write in code to actually end the macro?

Thanks
 
I hesitated, with that because I do all my Accpac codeing externally and don't use macros. I use a code line as follows,

Code:
End

Yes, it's that simple. This is a VB key word that basically kills the App. It should be the last line of code executed. The same thing is used in Access VBA so I would think that it will work in an Accpac macro. Any way if it doesn't you will get an error.

Thanks and Good Luck!

zemp
 
Well, thanks for all the help Zemp. Looks like I might have found a solution that seems to work. I had tried using the &quot;End&quot; keyword before and it didn't make any difference.

What I have tried that seems to work is a different connection string. I did some digging on the Pervasive site and found another way to declare the connection string, so I used the following syntax instead of my original:

adoconn.Open &quot;Provider=PervasiveOLEDB;Data Source=path to DB&quot;

When I execute the macro using this connection string, everything is working properly, so I guess that fixed it. Not quite sure how to explain it though.

Thanks again for the help.
 
Yes, there is an issue with the pervasive OLEDB provider, forgot about it. I don't quite remeber what it was however, I would have to search the pervasive SQL forum for an answer.

Glad to hear you got it working.


Thanks and Good Luck!

zemp
 
Hmmm...well for me, using the OLEDB Provider in the connect string worked whereas using the Pervasive ODBC Client Interface for the driver was causing all the problems.

Thanks
 
It's a different bug. The OLEDB provider has a bug that prevents @@IDENTITY from returning correctly. I should have looked it up before I opened my big mouth. See thread318-513703.

Always good to hear about a new bug though.

Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top