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

compile error : Procedure too long 1

Status
Not open for further replies.

Shusha

IS-IT--Management
Jun 27, 2001
50
0
0
CA
Hi there,

I certainly can use some help here. Pls let me know if any of you had this problem and how u solved it.. a big thanks comes your way.

We have this huge questionaire of containing over 400 questions and the answers for some depend on cumultive totals of afew and likewise.
I have this humungous procedure that contains all of this code for teh questionnaire. When i use the form to enter data , it comes up with a compile error of PROCEDURE TOO LARGE.

Is there some way i can split the procedure into 2 and use it in one form without disturbing the logic. I know that the compiled state cannot exceed 64K.. this is the problem. All of the calcs refer to this one psycholgical form that passes answers from one field to another.

I will paste some of the code here so u can understand what i mean.. any help is appreciated.

Usha

PS: here is some of the code

This is the subform module t24 which contains a lot of these calls:

Private Sub T24_1_AfterUpdate()
Call calctemp24
End Sub

Private Sub T24_10_AfterUpdate()
Call calctemp24
End Sub

Private Sub T24_100_AfterUpdate()
Call calctemp24
End Sub
.................. and more like this

And here is calcemp24

Public Function calctemp24()
counter1 = 0
counter2 = 0
counter3 = 0
counter4 = 0
counter5 = 0
counter6 = 0
counter7 = 0
counter8 = 0
counter9 = 0
counter10 = 0
counter11 = 0
counter12 = 0
counter13 = 0
counter14 = 0
counter15 = 0
counter16 = 0
counter17 = 0
counter18 = 0
counter19 = 0
counter20 = 0
counter21 = 0
counter22 = 0
counter23 = 0
counter24 = 0
counter25 = 0
counter26 = 0

If frm!T24_7 = 888 Then counter1 = counter1 + 1
If frm!T24_7 = 999 Then counter2 = counter2 + 1

If frm!T24_33 = 888 Then counter1 = counter1 + 1
If frm!T24_33 = 999 Then counter2 = counter2 + 1

If frm!T24_38 = 888 Then counter1 = counter1 + 1
If frm!T24_38 = 999 Then counter2 = counter2 + 1

If frm!T24_40 = 888 Then counter1 = counter1 + 1
If frm!T24_40 = 999 Then counter2 = counter2 + 1

If frm!T24_41 = 888 Then counter1 = counter1 + 1
If frm!T24_41 = 999 Then counter2 = counter2 + 1

If frm!T24_44 = 888 Then counter1 = counter1 + 1
If frm!T24_44 = 999 Then counter2 = counter2 + 1

If frm!T24_82 = 888 Then counter1 = counter1 + 1
If frm!T24_82 = 999 Then counter2 = counter2 + 1

If frm!T24_107 = 1 Then frm!T24_107R = 7
If frm!T24_107 = 2 Then frm!T24_107R = 6
If frm!T24_107 = 3 Then frm!T24_107R = 5
If frm!T24_107 = 4 Then frm!T24_107R = 4
If frm!T24_107 = 5 Then frm!T24_107R = 3
If frm!T24_107 = 6 Then frm!T24_107R = 2
If frm!T24_107 = 7 Then frm!T24_107R = 1
If frm!T24_107 = 888 Then frm!T24_107R = 888
If frm!T24_107 = 999 Then frm!T24_107R = 999

If frm!T24_107R = 888 Then counter1 = counter1 + 1
If frm!T24_107R = 999 Then counter2 = counter2 + 1

If frm!T24_111 = 888 Then counter1 = counter1 + 1
If frm!T24_111 = 999 Then counter2 = counter2 + 1
...

and end part of the module is this


frm!T24ctant = counter2
frm!T24ctfoc = counter4
frm!T24ctshf = counter6
frm!T24ctdis = counter8
frm!T24cthi = counter10
frm!T24ctinh = counter12


frm!T24ct999 = counter2 + counter4 + counter6 + counter8 + counter10 + counter12 + counter14 + counter16 + counter18 + counter20 + counter22 + counter24 + counter26

End Function


this is only part of the code..

please let me know if there is a way i can break up this module into two or three small ones at the same time be able to use the answers/calcs from first one in the second module and from the second one in the third.. the final stats that come from all these three modules will be the assessed values for one client..

thanks a million in advance

usha
 
Assuming that Counters are defined outside of the procedure then just break the procedure in the middle and put in call to the new procedure at the break.

' Before
If frm!T24_7 = 888 Then counter1 = counter1 + 1
If frm!T24_7 = 999 Then counter2 = counter2 + 1

If frm!T24_33 = 888 Then counter1 = counter1 + 1
If frm!T24_33 = 999 Then counter2 = counter2 + 1

If frm!T24_38 = 888 Then counter1 = counter1 + 1
If frm!T24_38 = 999 Then counter2 = counter2 + 1

If frm!T24_40 = 888 Then counter1 = counter1 + 1
If frm!T24_40 = 999 Then counter2 = counter2 + 1

'After
If frm!T24_7 = 888 Then counter1 = counter1 + 1
If frm!T24_7 = 999 Then counter2 = counter2 + 1

If frm!T24_33 = 888 Then counter1 = counter1 + 1
If frm!T24_33 = 999 Then counter2 = counter2 + 1
Call CalcTemp
End Sub

Public Function calctemp24A()

If frm!T24_38 = 888 Then counter1 = counter1 + 1
If frm!T24_38 = 999 Then counter2 = counter2 + 1

If frm!T24_40 = 888 Then counter1 = counter1 + 1
If frm!T24_40 = 999 Then counter2 = counter2 + 1
End Sub

Forms/Controls Resizing/Tabbing
Compare Code
Generate Sort Class in VB
Check To MS)
 
Hi John,

All of the counters are part of the Module.. so it is declared within the module. can u please elaborate on what u mean by: "Assuming that Counters are defined outside of the procedure "

I have taken over this db from someone who has done the coding etc. also, i am not that familiar with Vb.. learning it albeit real slow.. so can u please tell me where i shd declare the counters.. dont the counters have to be part of the module as it all of the calc's refer to those coutners. also, what isnt there a problem with nested modules or procedures. Pls. help. thanks
usha
 
Hi John,
If i was religious , i wld have said God Bless you. But religious I am not.. So I give you a star and maybe a few more stars for pointing me in the right direction. I am mainframe programmer and what u suggested is akin to what we do there. If the program is too large, break it in smaller modules but make the call from within the master Module. My thick head jsut couldn't figure that out and your help is greatly appreciated for it has saved me many hrs of agony. Thanks a million.
This site is awesome for us developers.. the wealth f knowledge abse is astounding. Whenver i get a few mins. to myself i visit the site and read up on all questions that i find interesting.
It is having people like you that makes the world a rich experience. thanks
usha
 
I have been a mainframe programmer since 1965 and a VB programmer since 1995, all for the same company. Our applications were outsourced to an ASP in the US recently but Telephone Banking and Web Banking were kept locally. It just so happened that I and another guy had wrtten the original code in the mainframe and were also more than familiar with .Net Framwework. It was a no-brainer for them to have us re-write the Customer Interface to run on Windows.

Tip. Never waited for training. Be ahead of the curve.


Forms/Controls Resizing/Tabbing
Compare Code
Generate Sort Class in VB
Check To MS)
 
Hi john,

I agree. Never wait for them to catch up.. I have always been ahead of the game and it is worth it. But there are times when one gets stuck and there is no one I can turn to for anything as I support all of the systems.. this access project was one of a kind.. an assessment database.. i managed to complete the entire project single handedly. I inherited a couple of assessments from another team and it is a huge 450 questions assessment. we are going to have problems with the tables too if more trials are added.. their tables are all filled to the brim.. have gone way past the 100 fields.. they are more at the max limit of 255.. so i have broken up the tables in 2 seperate ones.. is there anything i need to keep in mind as both of the tables wld be referring to one questionaire, one record in each table only thing is it is split. so i have given them a solution but i have to see if it worked.
So that is where i am right now.
We had an accident, and i cant focus for too long. woes of being rear ended by a 19 yr old who swears that he was coming at 20..
Thks for ur tip John.. Appreciate it a lot
usha
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top