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

One more question about running the compiling code from my final command
button... I was told that in order to run do the RunCommand.AcCmdCopy
function/procedure that Focus must be set to a control from which to copy the
text. Will it work w/o having a text box to which to set focus and from
which to copy it??

Thanks!
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]
.