having trouble with vba code

Jon123

Registered User.
Local time
Today, 10:37
Joined
Aug 29, 2003
Messages
668
To start off my problem started with a Select Case that got to big and started causing a complier error "Procedure Too Large" So after doing some research I figured that I needed to break the Cases down into inidivial procedures. So I figured it would be easier to create seperate Functions for each case and then have the Funcation called out be the Select case. I have it just about done (I think) but I'm having an issue with the ActiveControl between 2 forms.

Code:
If Forms![Frm-main].ActiveControl.Name = "step3" And (Forms![Frm-initals].[newinitals].[newinitals]) = "N/A"

I'm getting a run time 438 "Object does not support this medoth

Any ideas?

Is there a better way to break the code up?
 
awesome

thank you
 
Is there a better way to break the code up?

Could you paste this massive select case. We might be able to save you a headache here.
Worth a try :)
 
I think I'm ok breaking it down into smaller procedures. Better and easier to handle.
1 question tho is it better to have the Select Case result Call a function or break down to Call a Sub ?

Private Sub PROC1()
.... do something
End Sub

or
Function PROC1()
... do something
End Function

or does it not matter ?
 
Well that depends on your procedure.
What do you mean by break down to Call a Sub?
Do you mean call specific Subs within each Case that matches?
 
So say my select case has 25 different cases and the code within each case is specific to that case. So I could build a module with the 25 different functions in it or I could just create 25 Private Sub
like
Proc1()
...code
End Sub

Proc2()
... code
end sub

etc etc etc
to proc25()

and Functions are better left if all 25 cases were calling the same piece of code correct?
 
Also depends on your code.
I'm sure there is a better way to structure something like this, though without the code or an idea of what is going on, I can't help.

Sorry
 

Users who are viewing this thread

Back
Top Bottom