Wrox Programmer Forums
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 11th, 2007, 06:55 AM
Registered User
 
Join Date: Apr 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Expression Too Complex

I keep getting an error 16 "Expression Too complex" message when I run a subroutine. The problem goes away when I break in the code window and resume but I want to figure out the source off the problem. The line that causes the error is:

dblOrderData(iTab, ORDER_IX.Buy_Price, iInstrument) = 0

dblOrderData is a 3 dimensional array of doubles. The Microsoft help says that this error occurs when more than 8 nested floating-point calculcations take place at the same time but here I am simply setting the value to zero.

Does anyone ave any ideaa?

Thanks

John

 
Old April 11th, 2007, 07:03 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

John,

Whats the "ORDER_IX.Buy_Price" value and where does it come from?

Regards,
Rob

 
Old April 11th, 2007, 07:06 AM
Registered User
 
Join Date: Apr 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

"ORDER_IX.Buy_Price" is an enum value and equal to 0

 
Old April 11th, 2007, 07:18 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Whats the state of the variables at the time, how are they initialised?

I have never experience this one before myself, and Im struggling for ideas, may be useful to understand a bit more about "behind the scenes".

Regards,
Rob

 
Old April 11th, 2007, 07:32 AM
Registered User
 
Join Date: Apr 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The state of the variables before the line:

dblOrderData(iTab, ORDER_IX.Buy_Price, iInstrument) = 0

iTab=0
ORDER_IX.Buy_Price=0
iInstrument=0

ubound(dblOrderData,1)=0
ubound(dblOrderData,2)=6
ubound(dblOrderData,3)=92

I have an error handler in my code as follows:

[...]
GoTo ExitProc

ErrorHandler:
    If Err.Number = 16 Then
        'expression too complex error
        Resume
[...]

And I have set a breakpoint on the Resume line. If I hit F5 (Continue the code after it breaks), it runs OK but I just don't get why it breaks in the first place.

 
Old April 11th, 2007, 07:42 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

How about the Call Stack?

Sorry to keep digging for info, but you've got my curiosity! =)

Rob

 
Old April 11th, 2007, 08:36 AM
Registered User
 
Join Date: Apr 2007
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

there's only 3 things in the call stack. Tough one huh?

It consistently happens in the same place even if I restart excel. i think i'm just going to have to stick with my resume hack.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Message> in query expression <expression>. (Error ybg1 Access 5 July 15th, 2007 05:42 AM
Complex Serialization abedijoo C# 2005 5 April 18th, 2007 10:38 AM
complex query g_vamsi_krish SQL Language 3 February 27th, 2006 10:48 AM
query too complex [email protected] Access 3 August 28th, 2003 09:01 AM
Complex Table (at least for me) lcsgeek Classic ASP Basics 1 August 19th, 2003 02:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.