connecting sub to form

  • Thread starter faapa via AccessMonster.com
  • Start date
F

faapa via AccessMonster.com

i know this question has been asked a 101 times but can someone PLEASE help
me with one bit - i cant find the right answer...

so far, I have a form (performance_targets) and a subform (performance_key).
the background to it -
1) if the user enters data in the performance_targets form - they MUST enter
infomation in all related textboxes on that form in order for the record to
be stored
2) if the user enters data in the subform, they must enter data in all
relvant fields in order for record to be saved

what i'm having trouble with is connecting the two!! does anyone know what i
could do to maybe navigate from the form to the subform? i've tried setfocus
(from parent to subform) which works but the subform still allows the user to
exit without completing the fields in subform...

i hope this makes sense! i'd really appreciate ANY help! thanks
 
D

DMV

what I would do is place code in the OnExit of the main form. I would check
to make sure that at least one of the field in your subform has been filled
out. If it has then I would place the command docmd.close. If not then I
would place a message box alert advising the person that they have not
completed the second section and make the cursor go to the subform. That way
this forces the person to pay attention to the error message and will not let
them exit the form until they have completed everything.

if they have to enter for all the fields you will have to have your code
check all those relevant fields. You can create a if then statement or a
loop.
 
Top