I have a login form. If a user enters the correct username and password I want to open certain forms and close the login form (among other things) when the Sign In button is clicked. I have this code in the cmdSignIn_Click() event:
-
DoCmd.OpenForm "f_Families"
-
DoCmd.OpenForm "f_GiftProcessing"
-
DoCmd.OpenForm "f_Reports"
-
DoCmd.OpenForm "f_SysMaintenance"
-
DoCmd.Close acForm, "f_Login"
-
However, what I want to have happen is after the login form is closed I want to set the focus to the f_Families form, the first form that was opened. Right now, the focus goes to the f_SysMaintenance form. I've tried adding a line of code after I close f_Login using all these different variations but none work:
-
Forms!f_Families.SetFocus
-
Forms!f_Families.Form.SetFocus
-
DoCmd.SelectObject acForm, "f_Families"
-
You'd think this would be a simple task but no matter what I try, the focus always goes to the last form opened in my code. How do I do this? Thanks!