January 29th, 2013, 04:50 AM
ms Access Macro Help
i tried using macro to locate it but doesn't work.
After logging in from "Login" Form it will open up a form "LoginMenu" with a list of buttons of Forms that i'm able to access to.
This Macro is in "LoginMenu" with a list of buttons of macro events
If [Forms]![Login]![cboUsername]="Admin" Then
Form name: Club
Data Mode: Read Only
Window mode: normal
and after i try logging in to admin and click Clubs
Error: Microsoft Access cannot find referenced form "Login"
i don't understand why it can't find the form when it's located together there...
January 29th, 2013, 06:24 AM
Can you post the code you are using to open the form [LoginMenu]?
January 30th, 2013, 05:34 AM
there's no code in LoginMenu, just buttons that i right-click > Build Event > marcro
Originally Posted by meratigoerr
January 30th, 2013, 05:38 AM
ah crap, sorry didn't read carefully and i can't edit post...
January 30th, 2013, 07:58 AM
Are you absolutely sure that the form with your log in button is called "Login"? Try replacing this line:
DoCmd.Close acForm, "Login"
Edit: Alternatively, just right-click the form in the navigation pane, select 'Rename', and call it Login!
DoCmd.Close acForm, Screen.ActiveForm.Name
January 30th, 2013, 10:24 AM
DoCmd.Close acForm, "Login" << yeah it's called Login
Originally Posted by Charlie_B
isn't this a do command to close the current form "login" ??
what's wrong with that??
January 30th, 2013, 12:27 PM
Long story short. You've trying to reference a field from a form that's already been closed.
in your code for the login form you have the line.
This closes the login form. Then you open the form "loginmenu" and run the code:
docmd.close acform, "Login"
this code specifically references a form that you've already closed. You'll have to save the required field to either: 1. call your if statement before you close the login form. 2. save your user name to the newly opened form. or 3. save your username to a global variable.
if [Forms]![Login]![cboUsername]="Admin" Then