User Name
Password

Go Back   Planetarion Forums > Non Planetarion Discussions > Programming and Discussion

Reply
Thread Tools Display Modes
Unread 19 May 2005, 18:04   #1
Howie17
Registered User
 
Join Date: Apr 2005
Posts: 5
Howie17 is an unknown quantity at this point
VB 6 -Skipping lines of code...

Ok so I've been working on this program for quite awhile and recently i've received this error saying "Procedure Is To Long" or something along those lines.. anyway i fixed that by creating a function and then calling that function from the procedure therefore splitting the code into two.. well now, the program runs gets to the function runs through a bit of the code and then skips the rest and goes back to the procedure that called it.

I've checked and double checked to make sure i didn't overlook an "Exit Sub" or something that would tell the program to skip the lines that it is, my only guess is that splitting the code into two chunks and calling the second chunk through a function will apparently not fix the "Procedure is to long" problem. Has anyone ever run into this before? Any guidence would be great.
Howie17 is offline   Reply With Quote
Unread 19 May 2005, 19:47   #2
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
Arrow Re: VB 6 -Skipping lines of code...

What's the error number?

Never heard of something like this, but it sounds like really really bad code (welcome spaghetti).



Well, splitting the code into multiple parts would exactly be the way to solve this problem. And it should work without skipping code.
You must've done something wrong.

Code?
__________________
[»] Entropy increases! :-/
JetLinus is offline   Reply With Quote
Unread 20 May 2005, 05:21   #3
Howie17
Registered User
 
Join Date: Apr 2005
Posts: 5
Howie17 is an unknown quantity at this point
Re: VB 6 -Skipping lines of code...

There's no error it simply stops in the middle of a function and goes back to the procedure that called it without completing the rest of the code.


form load
-calls cmdSearch

cmdSearch
-Executes quite a few lines of code
-then executes a call ShiftDisplay function

ShiftDisplay
-executes quite a few lines of code but half way through goes back to cmdSearch at the End Sub line




Code:

After this line of code it goes back to the cmdSearch procedure:

Code:
adoShifts.Recordset.MoveFirst
    mintRecordCount = 1
    'Set shifts for each employee based on day of the week.
   Do While Not mintRecordCount = adoShifts.Recordset.RecordCount + 1
        
       If adoShifts.Recordset.Fields(0).Value = cmdEmployee1.Caption Then
                     txtEmployee(mintRecordCount).Left = "960"

It is then followed by multiple ElseIf statments, which i know its suppose to skip. The code that follows the If statement isn't executed.

Last edited by Howie17; 20 May 2005 at 14:10.
Howie17 is offline   Reply With Quote
Unread 20 May 2005, 10:29   #4
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
Arrow Re: VB 6 -Skipping lines of code...

Just out of curiosity:
Quote:
i've received this error saying "Procedure Is To Long"
Do you still remember the error number? I'm just interested in this error, never heard of it...


Concerning your problem: Well. It still doesn't sound really believable.
Did you use Debug.Print or MsgBox to "prove" where the program "jumps out"?
Did you compile an exe and see if the same happens?

I strongly suggest to try "step by step" mode using F8. See what happens then.
No other idea right now, sorry...



(VB6 SP6 is installed?)
__________________
[»] Entropy increases! :-/
JetLinus is offline   Reply With Quote
Unread 20 May 2005, 10:46   #5
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Re: VB 6 -Skipping lines of code...

Don't you all just love VB6 ?
What happens if you compile it to machinecode BTW? Does it run fine then? It seems more of a problem with the interpreter than with the code.

I'd define a custom errorhandler for the second function and see if there's no error generated in there (I assume you inherit the first functions errorhandler ATM?).
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 20 May 2005, 13:57   #6
Howie17
Registered User
 
Join Date: Apr 2005
Posts: 5
Howie17 is an unknown quantity at this point
Re: VB 6 -Skipping lines of code...

Thats not the exact wording of the error but thats what its meaning was.. i'll try to get the error again and let you know the specifics...


Ok, it says:

Quote:
Compile Error:

Procedure too large

Quote:
Concerning your problem: Well. It still doesn't sound really believable.
Did you use Debug.Print or MsgBox to "prove" where the program "jumps out"?
Did you compile an exe and see if the same happens?
-As of yet no I haven't.

Quote:
I strongly suggest to try "step by step" mode using F8. See what happens then.
No other idea right now, sorry...
-This is what i did to determine that it even was skipping code


I took the code out of the function and placed it back in the cmdSearch procedure, I then shortened some of the code in the procedure and it no longer skips the code... so it seems to be something to do with calling a function... idk as long as i can manage the size of the procedure i guess i'll be alright. btw thanks for the help.

Last edited by Howie17; 20 May 2005 at 14:12.
Howie17 is offline   Reply With Quote
Unread 20 May 2005, 17:38   #7
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
Arrow Re: VB 6 -Skipping lines of code...

Quote:
Originally Posted by Structural Integrity
Don't you all just love VB6 ?
Yes I do at least, and you know that ;-)
__________________
[»] Entropy increases! :-/
JetLinus is offline   Reply With Quote
Unread 21 May 2005, 01:32   #8
queball
Ball
 
queball's Avatar
 
Join Date: Oct 2001
Posts: 4,410
queball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so littlequeball contributes so much and asks for so little
Re: VB 6 -Skipping lines of code...

Did you call End Sub instead of End Function?

(It might have to be Exit Sub instead of Exit Function - I'm not hot on VB syntax.)
__________________
#linux
queball is offline   Reply With Quote
Unread 21 May 2005, 11:29   #9
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
Arrow Re: VB 6 -Skipping lines of code...

Quote:
Originally Posted by queball
Did you call End Sub instead of End Function?

(It might have to be Exit Sub instead of Exit Function - I'm not hot on VB syntax.)
Usually VB fixes that by auto-correction. If not, then it should give a compiler error...
__________________
[»] Entropy increases! :-/
JetLinus is offline   Reply With Quote
Unread 21 May 2005, 14:44   #10
Caesar2
Commander
 
Caesar2's Avatar
 
Join Date: Sep 2001
Location: Netherlands
Posts: 146
Caesar2 is just really niceCaesar2 is just really niceCaesar2 is just really niceCaesar2 is just really nice
Re: VB 6 -Skipping lines of code...

Quote:
Originally Posted by http://msdn.microsoft.com/
Procedure too large
Specifics

When compiled, the code for a procedure can't exceed 64K. This error has the following cause and solution:

Code for this procedure exceeds 64K when compiled.
Break this, and any other large procedures, into two or more smaller procedures.
Found here
__________________
Quote:
Originally posted by Cochese
Cathaar are not overpowered.

You were just "bashed", live with it.
Caesar2 is offline   Reply With Quote
Unread 21 May 2005, 21:42   #11
Howie17
Registered User
 
Join Date: Apr 2005
Posts: 5
Howie17 is an unknown quantity at this point
Re: VB 6 -Skipping lines of code...

thanks for the lookup Caesar2. I figured that would fix it which it did... but now its confusing me to why its skipping lines of code, which i've bypassed by shortening the orignal procedure and keeping everything together... we'll see if i can get by with keeping the procedure within 64kb..
Howie17 is offline   Reply With Quote
Unread 22 May 2005, 01:22   #12
Structural Integrity
Rawr rawr
 
Structural Integrity's Avatar
 
Join Date: Dec 2000
Location: Upside down
Posts: 5,300
Structural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriendStructural Integrity needs a job and a girlfriend
Re: VB 6 -Skipping lines of code...

Quote:
Originally Posted by Caesar2
Typical...
"Hey... let's statically allocate memory for procedures... 64k should do it."

I get the shivers when I see stuff like that. It once took me two days to hunt down a bug that crashed the IDE because someone decided it'd be cool to have a statically allocated array filled by a function in a DLL, and then go over the bounds.
Particularly cool when you don't have the code of the DLL, and don't even have an idea what the fk it does.

Well, atleast these guys were nice enough to generate an error instead of just letting it crash and burn.
__________________
"Yay"
Structural Integrity is offline   Reply With Quote
Unread 22 May 2005, 01:41   #13
Demon Dave
Insanity Prawn Boy!
 
Demon Dave's Avatar
 
Join Date: Dec 2001
Location: In a bush where you can't find me
Posts: 2,474
Demon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriendDemon Dave needs a job and a girlfriend
Re: VB 6 -Skipping lines of code...

for some strange reason known only to himeself, my college admin has decided to block all microsoft websites. even msdn
__________________
They shall not grow old, as we who are left grow old:
Age shall not weary them, nor the years condemn.
At the going down of the sun and in the morning
We shall remember them.
Demon Dave is offline   Reply With Quote
Unread 23 May 2005, 21:19   #14
Epcylon
Registered User
 
Join Date: Apr 2000
Location: Oslo, Norway
Posts: 78
Epcylon is a glorious beacon of lightEpcylon is a glorious beacon of lightEpcylon is a glorious beacon of lightEpcylon is a glorious beacon of lightEpcylon is a glorious beacon of light
Re: VB 6 -Skipping lines of code...

Sounds like a sensible sysadmin tbh..
__________________
Epcylon
[R1]: noob | [R2]: B8S/ICD | [R3-5]: ICD | [R6]: HR | [R7-9.5]: HR/NoS |
[R10]: HR RecOff | [R10.5]: HR RO -> HR HC -> HR pe0n | [R11]: HR pe0n -> Leave of Absence |
[R12]: HR free-pe0n | [R13-]: HR pe0n
Epcylon is offline   Reply With Quote
Unread 23 May 2005, 22:42   #15
Raging.Retard
Street Tramp
 
Raging.Retard's Avatar
 
Join Date: Apr 2000
Location: Street Gutter
Posts: 341
Raging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant futureRaging.Retard has a brilliant future
Re: VB 6 -Skipping lines of code...

This begs the question, why do you have (or need) a single procedure thats 64k in length?
__________________
Chimney Pots.
Raging.Retard is offline   Reply With Quote
Unread 24 May 2005, 04:51   #16
JetLinus
Friendly geek of GD :-/
 
JetLinus's Avatar
 
Join Date: Nov 2000
Location: On my metal roid
Posts: 923
JetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud ofJetLinus has much to be proud of
Arrow Re: VB 6 -Skipping lines of code...

Because he needs some lines of code to executed a couple of hundred times?

[/badjoke] :-/
__________________
[»] Entropy increases! :-/
JetLinus is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Forum Jump


All times are GMT +1. The time now is 18:45.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2002 - 2018