Editing SubForm Data From Main Form! (1 Viewer)

bob fitz

AWF VIP
Local time
Today, 14:44
Joined
May 23, 2011
Messages
4,717
Hi vbaInet
There's another way, but I prefer this one.
Can you tell us the other way and why you prefer the method that you've already shown?
 

vbaInet

AWF VIP
Local time
Today, 14:44
Joined
Jan 22, 2010
Messages
26,374
Hi Bob,

Test if the form is open (not loaded) before running the function. It's apparent now that the former suggestion is much neater because you don't have to constantly check before running the code in the Current event.
 

bob fitz

AWF VIP
Local time
Today, 14:44
Joined
May 23, 2011
Messages
4,717
Hi vbaInet

Do you have any thoughts on just catching the error in the event's error proc and dealing with it there?
 

vbaInet

AWF VIP
Local time
Today, 14:44
Joined
Jan 22, 2010
Messages
26,374
Hi Bob,

That's definitely another way but it would be more counter-productive to create ways to avoid it throwing an error than catching it. The general idea behind error trapping is to:

1. Display a more descriptive message for unavoidable errors that we know for certain will occur at some point. Error 2501 is a good example of this kind of error.
2. Display a message for errors that we anticipate.
3. Points 1 and 2 + carry out some action when it occurs.
4. Stop the app from crashing and letting it continue (if needs be).

So if it can be avoided, it would make sense to avoid catching avoidable errors by all means.
 

Users who are viewing this thread

Top Bottom