Results 1 to 3 of 3
  1. #1
    excellenthelp is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Mar 2014
    Posts
    93

    Unable to find Form

    Hello.

    I wrote a code and this line keeps getting highlighted in the debugger. I am trying to figure out how to fix the form reference... Can you help me?

    Code:
    cmd.CommandText = "SELECT AccessLevel FROM tblEmployee " _
                            & "WHERE UserName = '" & Forms!frmMainMenu!txtUserName & "'"
    Does it have to do something with dimming an object and setting an object to nothing between two different forms?

    Help...

  2. #2
    excellenthelp is offline Advanced Beginner
    Windows 8 Access 2013
    Join Date
    Mar 2014
    Posts
    93
    Ah... the form (frmMainMenu) has to be open while opening the other form with the code.

    Is there anyway I can do this with the form (frmMainMenu) either open or closed?

    Thanks!

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    Quote Originally Posted by excellenthelp View Post

    ...Is there anyway I can do this with the form (frmMainMenu) either open or closed
    You can only reference a Control on a Form if that Form is open.

    You're using Access 2013, so you could use TempVars to assign the user's name to a global variable and then use that in your reference.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Unable to Find Object Error
    By MHernan1 in forum Access
    Replies: 1
    Last Post: 08-15-2013, 04:11 PM
  2. Replies: 8
    Last Post: 06-02-2012, 11:26 AM
  3. Unable to update form
    By huongdl1987 in forum Forms
    Replies: 5
    Last Post: 05-31-2012, 03:10 PM
  4. Unable to add a record on a form
    By JamiB1979 in forum Forms
    Replies: 1
    Last Post: 06-22-2011, 08:36 PM
  5. Access 97: Unable to find project explorer?
    By captgnvr in forum Programming
    Replies: 0
    Last Post: 07-19-2010, 09:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums