473,385 Members | 1,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Procedure too large error

72
Hi can somebody tell me how can i resolve my "PROCEDURE TOO LARGE ERROR",,, my code is too large.. how can i resolve it.
May 18 '07 #1
10 10292
Killer42
8,435 Expert 8TB
I've never heard of that error. What version of Visual Basic is this?

Of course, the obvious answer is "make it smaller". If a procedure is too large, you probably need to break it up into smaller routines.
May 18 '07 #2
Dököll
2,364 Expert 2GB
Hi can somebody tell me how can i resolve my "PROCEDURE TOO LARGE ERROR",,, my code is too large.. how can i resolve it.
Listen to him darrel, break it down today, bit by bit. I have had this problem before, assuming you are using VB 6.0. The line of code you are using is too large, even if you build modules to handle some routines, VB will consider the code too long.

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...
May 19 '07 #3
darrel
72
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...
May 19 '07 #4
Dököll
2,364 Expert 2GB
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...
The module will again record length of your routine thus deemed too long per VB. I need you to tell me a little more about your program so I can tell you how to break it down:

(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!
May 19 '07 #5
darrel
72
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:

Expand|Select|Wrap|Line Numbers
  1.  
  2. 'Time Connection
  3. If rs.State = adStateOpen Then rs.Close
  4.        rs.Open "Select * from [Time]", cnn, adOpenKeyset, adLockOptimistic
  5.     While rs.EOF <> True
  6.         For x = 0 To 7
  7.         Combo1(x).AddItem rs.Fields("Time").Value
  8.         Next x
  9.      rs.MoveNext
  10.     Wend
  11. 'Time Connection
  12.  
  13. 'Room Connection
  14. If rs.State = adStateOpen Then rs.Close
  15.        rs.Open "Select * from [ROOMS]", cnn, adOpenKeyset, adLockOptimistic
  16.   While rs.EOF <> True
  17.     For x = 0 To 7
  18.         Combo2(x).AddItem rs.Fields("ROOM").Value
  19.     Next x
  20.   rs.MoveNext
  21.   Wend
  22. 'Room Connection
  23.  
  24. 'Days Connection
  25. If rs.State = adStateOpen Then rs.Close
  26.        rs.Open "Select * from [DAYS]", cnn, adOpenKeyset, adLockOptimistic
  27.   While rs.EOF <> True
  28.     For x = 0 To 7
  29.         Combo3(x).AddItem rs.Fields("DAYS").Value
  30.     Next x
  31.   rs.MoveNext
  32.   Wend
  33. End If
  34. 'Days Connection
  35.  
  36.  
how can i combined it in one single loop... i have the code with all the lines in my code so far... i always use those code for able for me to load the details in my database i hope youre getting what am trying to say, I hope you can help to simply this code or to teach how can i can a function and just call it up of my form. rhank you
May 19 '07 #6
Killer42
8,435 Expert 8TB
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.
May 19 '07 #7
darrel
72
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 much
May 19 '07 #8
Dököll
2,364 Expert 2GB
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 much
I hear your pain, darrel. You can get through it...

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!
May 19 '07 #9
Killer42
8,435 Expert 8TB
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 much
Sorry, I'll try to come up with something when I can. Have been extremely busy.
May 21 '07 #10
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).AddItem rs.Fields("TIME").Value
Combo2(x).AddItem rs.Fields("Room").Value
Combo3(x).AddItem rs.Fields("DAYS").Value
Next x
rs.MoveNext
Wend

I'm not sure
jus chk it and try
May 24 '07 #11

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Brian | last post by:
Hi there, I am converting a large PL/SQL project into Transact-SQL and have hit an issue as follows: I have a PL/SQL procedure that converts a string to a date. The procedure does not know...
0
by: George | last post by:
HI , I am getting the below error while i compile a Store procedure which is my main store procedure and does the call to all other supporting stored procedure. Compartively its a large file...
6
by: harborboy76 | last post by:
Hi, I am trying to insert a large number of rows into a table inside a SPL. But every time, I run the SPL, the table is locked because of the INSERT. When I tried to issue a COMMIT, right after...
5
by: Timppa | last post by:
Hi, Could anyone help me with my problem ? Environment: Access 2000 and Sql Server 2000. I have a stored procedure as follows: DROP table1 SELECT alias1.field1,alias2.field2,table2.field6...
5
by: Lyn | last post by:
Is there any way of determining in VBA the name and arguments of the currently executed procedure? To assist in debugging, I would like to be able to trace the procedures as they are executed. ...
2
by: nbohana | last post by:
I am trying to code an compile a stored procedure without success. So I generated one using Microsoft Visule C# .Net. and it follows. One of the problems is that it will not compile. Some of the...
1
by: colleen1980 | last post by:
This program runs fine in my company but when i try to run at home it gives that error: Compiler error: Procedure too large Thank You.
1
by: mjkelly | last post by:
Hi, I have a stored procedure written in java in an Oracle 10g db. This sp takes a java.lang.String as input, creates a file on disk and writes the string contents to it and inserts the filename...
0
by: eagleprof | last post by:
I have a stored procedure in my SQL Server 2000 database that has a large number of different queries (about 200 or so all up) over which a cursor iterates. This procedure works perfectly in the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.