Hi can somebody tell me how can i resolve my "PROCEDURE TOO LARGE ERROR",,, my code is too large.. how can i resolve it.
Procedure too large error
Collapse
X
-
Originally posted by darrelHi can somebody tell me how can i resolve my "PROCEDURE TOO LARGE ERROR",,, my code is too large.. how can i resolve it.
One option could be to add an aditional button and plug in the remaining code there, an ugly way of solving this but if you have a number of calls to make in one procedure, VB will be unhappy and will yell at you. There's gotta be an easier way, I stopped there after solving in my primitive fashion:-)
Sorry for your troubles, not fun...Comment
-
yah i know the only way to solve it is to break it up!!! but i dont know how! i think i need to create a function in a module but i dont know how?? can you give me some details on how can i achieve it.. its like am going to create a function and then calll it in my form everytime i need it.. hope you can help, i cant post my code here coz i will be too long...Comment
-
Originally posted by darrelyah i know the only way to solve it is to break it up!!! but i dont know how! i think i need to create a function in a module but i dont know how?? can you give me some details on how can i achieve it.. its like am going to create a function and then calll it in my form everytime i need it.. hope you can help, i cant post my code here coz i will be too long...
(1) Are you seaching/loading a file?
(2) How many command buttons do you have on the form
(3) Do you have sub forms
Answer these and we'll continue. Also it will be helpful to post your code, at least a portion of it to be specific.
In a bit!Comment
-
Thank you for replying. Yes am Searching with my database, I only have one command button fro now. And i dont know what is a sub form.
To give a background of my program, the program is a time scheduling of subjects in a particular university. Thats wer i work for,,,
I almost have 2400 line of commands,,, it has many selection. e.i. when i chose a particular choice with in my program it has to display details in my form, and the details are in my databse, i think i have a bunch of loops and tables..
Question: How can i combined a loop with diffenrent tables in my databse. heres the code:
Code:'Time Connection If rs.State = adStateOpen Then rs.Close rs.Open "Select * from [Time]", cnn, adOpenKeyset, adLockOptimistic While rs.EOF <> True For x = 0 To 7 Combo1(x).AddItem rs.Fields("Time").Value Next x rs.MoveNext Wend 'Time Connection 'Room Connection If rs.State = adStateOpen Then rs.Close rs.Open "Select * from [ROOMS]", cnn, adOpenKeyset, adLockOptimistic While rs.EOF <> True For x = 0 To 7 Combo2(x).AddItem rs.Fields("ROOM").Value Next x rs.MoveNext Wend 'Room Connection 'Days Connection If rs.State = adStateOpen Then rs.Close rs.Open "Select * from [DAYS]", cnn, adOpenKeyset, adLockOptimistic While rs.EOF <> True For x = 0 To 7 Combo3(x).AddItem rs.Fields("DAYS").Value Next x rs.MoveNext Wend End If 'Days Connection
Comment
-
Unfortunately, this sort of thing depends entirely on your code. The kind of thing you want to look for is anything which is done repeatedly, that you could put into a Sub or Function and call. Anything which can be done independently of the rest of the form. Things like that.
You have to try and work out how you can carve up your code into pieces, then move the pieces into a code module. This may mean setting up globals variables, or you may simply pass the relevant data to/from the routines as parameters and/or function return values.Comment
-
yes i know thats the solution to my problem, can i just copy paste the code that has been repeatedly done in my form, how can i do it! could you site me some example on how to build a function in a module and call it up when it is needed.. thank you very muchComment
-
Originally posted by darrelyes i know thats the solution to my problem, can i just copy paste the code that has been repeatedly done in my form, how can i do it! could you site me some example on how to build a function in a module and call it up when it is needed.. thank you very much
A sub form by the way is only another form within your main form, it could be included on a frame.
Alright, what must happen when the command button is pressed?
In my case, I was searching/reading/loading text to either a .txt file or MS Access database. I added three button: Search/Commit/View
(1) A portion of the code resided under Search (Added data to part of the form while the form remains invisible
(2) A portion of the code resided under Commit (Added data to part of the form while the form remains invisible
(3) Remaining code resided under View (Added remaining data to form and then form was visible.
What this means, you'll need to figure out a way to have a form that used solelly for searching your database, and only when the View button is pressed should the results form appear...
TIPS: Search button disappears and makes visible Commit buttton, then Commit button disappears to make visible View button. Search form disappears respectively upon entry of your results form
Good luck, and I hope this helps!Comment
-
Originally posted by darrelyes i know thats the solution to my problem, can i just copy paste the code that has been repeatedly done in my form, how can i do it! could you site me some example on how to build a function in a module and call it up when it is needed.. thank you very muchComment
-
What u can do is in every table add a field SI No
Then Run The Sql
rs.open "Select Time.SINo as Slno ,Time as Time1,Room as Room1,Days as Days1 from [Time],Room,Days where Time.SINo =Room.SINo and Time.SINo =Days.SINo"
While rs.EOF <> True
For x = 0 To 7
Combo1(x).AddIt em rs.Fields("TIME ").Value
Combo2(x).AddIt em rs.Fields("Room ").Value
Combo3(x).AddIt em rs.Fields("DAYS ").Value
Next x
rs.MoveNext
Wend
I'm not sure
jus chk it and tryComment
Comment