View Single Post
  #7  
Old January 5th, 2010, 01:46 AM posted to microsoft.public.access.forms
Pamela
external usenet poster
 
Posts: 193
Default Value Entered Isn't Valid...Error

Wow...that's a lot of scary work! I think I'll try to limp it by for the
time being before jumping into something that big - plus I'm sure you and all
the other helpful folks here could use a well deserved break from holding my
hand. LOL But really, thank you, obviously with all the help you've given
you know I couldn't have done any of it without you!

Pamela

"John W. Vinson" wrote:

On Mon, 4 Jan 2010 15:31:01 -0800, Pamela
wrote:

Hi John,
Thanks so much for that clarification. How does that work with subforms?


Exactly the same way. When the user takes an action which would cause the
subform data to be saved to disk - e.g. setting focus to the mainform, or
moving to a different record on the subform - the Subform's BeforeUpdate event
fires. The main form's event does not.

Are all of the subforms handled separately in that I'd need to do separate
BeforeUpdate events for each one and then only pertaining to the controls on
that subform or can they all be done from any of the forms?


Each (sub)Form has its own independent BeforeUpdate event.

For all of this
that I've been working on (thanks for all your help on it) I have a command
button at the botton of the last subform that selects an unbound text box
which, on it's GotFocus event, runs all of this code to lookup - based on
the user's data - and concatenate and then copy a nice little paragraph and
then close the form.


The GotFocus event will NOT fire unless the *user* manually sets focus to the
event. Rather than seting focus to the box and letting the GotFocus code fill
it, you should fill it directly in the button's Click event.

The user can then paste that paragraph into whatever
outside application needed. With this in mind, could I run the validation
codes for all of these controls on that button and then also go ahead and run
the code for compiling my paragraph?


I'd suggest validating in the Form's BeforeUpdate event. Having the validation
in the button code might work but it'll be more complex since it has to look
not only at multiple fields, but multiple forms!

Getting it "right" which seems to be
somewhat subjective, may help with all of these problems I'm running into.


It is always subjective. That's why us consultants are all independently
wealthy cough cough...
--

John W. Vinson [MVP]
.