set focus from subform to Main Form

hamrthroer

Registered User.
Local time
Today, 07:34
Joined
Jul 30, 2008
Messages
33
I have a Form with two subforms. The user enters a value into a textbox named NUMBER. The OnEnter event populates sfrmInfo with the fields; NUMBER, LAST_NAME, FIRST_NAME, ADDRESS. I have some validation code and if the NUMBER is valid an Add Record command button appears and they can then add the record. If the NUMBER is false a msg box pops up blah blah and they click ok. I'm trying to use Docmd.GoToControl to go into the number text box on the main form but all the code I've tried puts it into the sfrmInfo text box of the same name (NUMBERS). The dude that wrote this had no clue about naming conventions. Whats the surefire way of distinguishing which control to go to?

I'm a bit of a Newbie so be gentle...
 
Try something like forms!formname.controlname.setfocus instead of the goto control command.
 
Sweet! I'll give er a try tomorrow. Thanks!
 
Book mark this site it gives you the correct syntax for referencing subforms/forms and their controls.
 
OOOOO....that is a sweet site. consider that one saved for me too! :D

Thanks John!

LWC
 
Great site! I haven't had a chance to try the fix yet. Thanks for all your help!:)
 
Thanks JBB! The site set me straight! My next task is to keep the info in sfrmInfo from inserting into an existing record. Thanks again! AWF Rules! :cool:
 

Users who are viewing this thread

Back
Top Bottom