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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a Stored Procedures Access Violation

Status
Not open for further replies.

SundancerKid

Programmer
Oct 13, 2002
116
US
I was trying to use a Union Query in MS access to put two files together and add to a Crystal Report. The main database is ACCPAC 5.1 OEINVH, OEINVD Union to OECRDH & OECRDD. I am trying to match up the invoiced items with Credit Memo's done the same period.

The Union Query looks like this:

SELECT OEINVH.SALESPER1 as SALES, OEINVH.CUSTOMER as CUST, OEINVH.BILNAME as Name, OEINVH.TERRITORY as Terr, IIf(OEINVD!LINETYPE=1,"IN"," ") AS Type, OEINVH!INVNUMBER AS Reference, OEINVH.INVDATE as OEDATE, OEINVD!UNITPRICE*OEINVD!QTYSHIPPED AS SalesAmt, OEINVD!QTYSHIPPED*OEINVD!UNITCOST AS CostAmt
FROM OEINVH INNER JOIN OEINVD ON OEINVH.INVNUMBER = OEINVD.INVNUMBER
WHERE (((IIf([OEINVD]![LINETYPE]=1,"IN"," "))="IN"))

UNION

SELECT OECRDH.SALESPER1 AS Sales, OECRDH.CUSTOMER AS Cust, OECRDH.BILNAME AS Name, OECRDH.TERRITORY AS Terr, IIf([OECRDD]![LINETYPE]>0,"CN"," ") AS TYPE, IIf([OECRDD]![LINETYPE]=1,[OECRDH]![CRDNUMBER],Trim([OECRDH]![CRDNUMBER]) & "-" & Trim([OECRDD]![MISCCHARGE])) AS Reference, OECRDH!CRDDATE AS INVDATE, IIf([OECRDD]![LINETYPE]=1,[OECRDD]![QTYRETURN]*[OECRDD]![UNITPRICE],[OECRDD]![EXTCRDMISC]) AS SalesAmt, IIf(OECRDH!CRDSTATUS=2 And OECRDD!RETURNTYPE=1,OECRDD!QTYRETURN*OECRDD!UNITCOST,0) AS CostAmt
FROM OECRDH INNER JOIN OECRDD ON OECRDH.CRDUNIQ = OECRDD.CRDUNIQ
WHERE (((IIf([OECRDD]![LINETYPE]>0,"CN"," "))="CN"));

The union query works fine inside MS Access. But I am unable to access it outside of Access. I proceeded to build a table in access from the query and I am able to access the information.

I would like to use a pervasive Stored Procedure but I keep getting the following error:

Pervasive] [ODBC Client Interface] [Client LNA] [The ODBC Client Interface]Access Violation

Please Help, Thanks in advance

SDK
 
SDK,

Did you have any luck with your stored procedure? I am trying to do something similar, calling a stored procedure that populates a pervasive table from Crystal Reports for ACCPAC Advantage Series and am getting the same error.

 
Does it work if you execute the query in the control centre or SQL Scope?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top