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

Invalid procedure call - Error number 5 - Issue in QB_Connector 

Status
Not open for further replies.

weightinwildcat

Programmer
May 11, 2010
84
US
I am working with two queries, each of which is calls on a third query for information. Each of the first two queries use SELECT DISTINCT. Lately they have both caused the message Invalid procedure call. (Error number 5.). When I remove the DISTINCT they run. When I put DISTINCT back in they fail and the same message appears.

Each of the first two queries is drawing a calculated text field from the third query. The third query itself draws information from a fourth query and a table in another Access database.
 
Can you post SQLs of all queries involved??

combo
 
Here is the query that seems to be the issue:

SELECT AssemblyToEngineering.CollectionPrefix, AssemblyToEngineering.Base, AssemblyToEngineering.Trim, ItemList_CF.[CF_Item_CF_tem_QRY.CF_Item] AS ProductID, AssemblyToEngineering.EngineeringPrefix, AssemblyToEngineering.EngineeringSuffix, ItemList_CF.Assembly, IIf([CollectionPrefix] Is Not Null,([EngineeringPrefix] & (Right([Assembly],(Len([Assembly])-Len([CollectionPrefix])))) & [EngineeringSuffix]),[Assembly]) AS TrueAssembly, IIf([CollectionPrefix] Is Not Null,([EngineeringPrefix] & (Right([Assembly],(Len([Assembly])-Len([CollectionPrefix]))))),[Assembly]) AS BaseAssembly
FROM ItemList_CF LEFT JOIN AssemblyToEngineering ON (ItemList_CF.AssemblyPrefix = AssemblyToEngineering.CollectionPrefix) AND (ItemList_CF.isBaseNumberOrText = AssemblyToEngineering.Base) AND (ItemList_CF.isAccentNumbeOrTextr = AssemblyToEngineering.Trim)
WHERE ((([ItemList_CF].[CF_Item_CF_tem_QRY.CF_Item]) Is Not Null))
ORDER BY ItemList_CF.[CF_Item_CF_tem_QRY.CF_Item], ItemList_CF.Assembly DESC;
 
Test if Right function has proper length in second argunent, i.e no negative values.
You can copy query and replace:
1. [tt]([EngineeringPrefix] & (Right([Assembly],(Len([Assembly])-Len([CollectionPrefix])))) & [EngineeringSuffix])[/tt] by [tt](Len([Assembly])-Len([CollectionPrefix]))[/tt]
2. [tt]([EngineeringPrefix] & (Right([Assembly],(Len([Assembly])-Len([CollectionPrefix])))))[/tt] by [tt](Len([Assembly])-Len([CollectionPrefix]))
[/tt]
and separately filter negatives.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top