Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 7th, 2011, 06:21 PM
Authorized User
Points: 82, Level: 1
Points: 82, Level: 1 Points: 82, Level: 1 Points: 82, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default Invalid Procedure Call

Hello,

This query returns an "Invalid Procedure Call" error because of the Len function:
SELECT DISTINCTROW tbl_Launch_L.CO_NUMBER, tbl_Launch_L.FRT_CHG_CD, tbl_Launch_L.Ship_Via, tbl_Launch_L.Ship_Via_Code
FROM tbl_Launch_L INNER JOIN tbl_ShippingCodes_L ON tbl_Launch_L.Ship_Via_Code = tbl_ShippingCodes_L.CODE
WHERE (((tbl_Launch_L.FRT_CHG_CD)='2') AND ((tbl_Launch_L.Ship_Via) Like '*:*') AND ((tbl_ShippingCodes_L.Type)='N') AND ((tbl_ShippingCodes_L.Required)='Y') AND ((IsNumeric(Right([SHIP_VIA],Len([SHIP_VIA])-4)))<>1))
ORDER BY tbl_Launch_L.CO_NUMBER;

This query works perfectly when I hard code the length:
SELECT DISTINCTROW tbl_Launch_L.CO_NUMBER, tbl_Launch_L.FRT_CHG_CD, tbl_Launch_L.Ship_Via, tbl_Launch_L.Ship_Via_Code
FROM tbl_Launch_L INNER JOIN tbl_ShippingCodes_L ON tbl_Launch_L.Ship_Via_Code = tbl_ShippingCodes_L.CODE
WHERE (((tbl_Launch_L.FRT_CHG_CD)='2') AND ((tbl_Launch_L.Ship_Via) Like '*:*') AND ((tbl_ShippingCodes_L.Type)='N') AND ((tbl_ShippingCodes_L.Required)='Y') AND ((IsNumeric(Right([SHIP_VIA],Len(13-4)))<>1))
ORDER BY tbl_Launch_L.CO_NUMBER;

There is no ship_via value in my table with a length of less than 13 - so it never returns a negative number. I'm stumped. Can anyone help??!!

Thanks,
D
Reply With Quote
  #2 (permalink)  
Old June 7th, 2011, 08:07 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Maybe a null value???

and I don't understand the idea of this.. you are reading the n(4) char of the string.. so if the string has 6 char you are out, and if the string has 5, you take it and compare it to 1... IT's that a correct logic?
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
Reply With Quote
  #3 (permalink)  
Old June 8th, 2011, 09:45 AM
Authorized User
Points: 82, Level: 1
Points: 82, Level: 1 Points: 82, Level: 1 Points: 82, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi gbianchi,

Thanks for responding. I am still struggling with this.
There are no null values in the ship_via field.
As for the code - Our FedEx ship vias looks like this "FGR:332158321". The "FGR:" is the shipping "code" and the numbers are our customer's account number. I extract the account number by asking for the right 9 characters. This is the same as saying 13-4 or Len([SHIP_VIA])-4). I then test to make sure that the 9 characters are all numeric.

Thanks,
D
Reply With Quote
  #4 (permalink)  
Old June 8th, 2011, 07:50 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Ok, another idea, use the mid (or was substr in access?) function, starting at 4????

This will return string that start at position 4...

see if that fails...
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
Reply With Quote
  #5 (permalink)  
Old June 9th, 2011, 09:52 AM
Authorized User
Points: 82, Level: 1
Points: 82, Level: 1 Points: 82, Level: 1 Points: 82, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , USA.
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks - but I would still need to use the Len function within the Mid to determine how many characters are to the right of the 4th. Ex: mid(4,Len([ship_via])-4)
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Error: Invalid postback or call back argument kalyanykk ASP.NET 2.0 Basics 0 August 26th, 2008 07:03 AM
On Load: "Invalid Outside Procedure" kritimehrotra BOOK: Beginning Access 2003 VBA 3 March 1st, 2007 11:53 AM
java.sql.SQLException: Invalid argument(s) in call dharmendra_rh Java Databases 1 May 5th, 2005 03:58 AM
Invalid procedure call Error pavel Pro VB 6 2 January 30th, 2004 10:00 AM
Invalid procedure call or argument: 'AscB' harish3699 VBScript 1 January 28th, 2004 01:29 PM



All times are GMT -4. The time now is 05:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.