Invalid Procedure Call Message

  • Thread starter Thread starter Anthony Viscomi
  • Start date Start date
A

Anthony Viscomi

I have a problem; I've copied an existing query within the same db and the
only change that I've made to the query was the underlying table. Heres what
I have for the new query:

SELECT Left([pricingUK]![PRINUM],InStr([pricingUK]![PRINUM]," ")-1) AS
[SKU#], pricingUK.OMPRICE AS Cost, Max(pricingUK.PRIOBS) AS MaxOfPRIOBS,
pricingUK.QTY
FROM pricingUK
GROUP BY Left([pricingUK]![PRINUM],InStr([pricingUK]![PRINUM]," ")-1),
pricingUK.OMPRICE, pricingUK.QTY
HAVING (((pricingUK.OMPRICE)>0) AND ((pricingUK.QTY)=1))
ORDER BY Left([pricingUK]![PRINUM],InStr([pricingUK]![PRINUM]," ")-1);

This worked fine using the original query and the underlying table for that
query si exactly like the pricingUK table, except for the data.

Everytime I run the above I receive an "Invalid Procedure Call" error. if I
remove the "-1" it runs fine.

Any thoughts?

Anthony
 
If there is no space in the text, the InStr expression will return 0. Deduct
1 from that and you get -1. And a negative number is not valid as the Length
argument of the Left function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top