Results 1 to 6 of 6
  1. #1
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124

    Getting name of activeform


    I am using the MSACCESS Navigation control and when I open the application I want to allow the user to press Shift F1 to call and display a Word document whose name is based on the name of the "activeform". However when I use the command : Screen.ActiveForm.name to get the name I get an error 2475 which says "You entered an expression that requires a form to be the active window". The form shown is the "MainNavSubform" but I need the name of the form "held" in the "MainNavSubForm" of the Navigation control, but I can't figure out how to do this. Any help would be appreciated. I like the Navigation control but I am finding that it is difficult to get clear info regarding how to refer to controls on the Navigation control. I would appreciate any Help on this problem.

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,837
    activeform means the form with the focus so perhaps you need to go to this form first. Personally I don't use the navigation control as I find it too restrictive - perhaps you should consider building your own.

  3. #3
    JrMontgom is offline Competent Performer
    Windows Vista Access 2010 32bit
    Join Date
    Sep 2012
    Location
    Vero Beach, FL USA
    Posts
    124
    Quote Originally Posted by Ajax View Post
    activeform means the form with the focus so perhaps you need to go to this form first. Personally I don't use the navigation control as I find it too restrictive - perhaps you should consider building your own.
    Thanks for the prompt response to my uestion but I have created the total application using the Navigation control with no problems until I reached this particular problem. I find the NC to be pretty easy to use and very user friendly up to this point. If anyone has a solution to my particular problem I would appreciate any help.

  4. #4
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,837
    Sounds like you are getting to where I am

    Good luck with your project

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    It sounds like you do not have any active forms when the code is being executed. I placed a Control Button inside a Nav Control and also added a nav button and placed the following code behind without any issues.

    Code:
    MsgBox Screen.ActiveControl.Name
    MsgBox Screen.ActiveForm.Name

  6. #6
    IrogSinta is offline Competent Performer
    Windows 8 Access 2013
    Join Date
    Jun 2015
    Posts
    103
    To get the name of the current form in your navigation control, use the syntax Me.NameOfNavigationControl.Form.Name
    So if your navigation control is called MainNavSubForm, you can try this:
    Msgbox Me.MainNavSubForm.Form.Name

    Ron

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

Similar Threads

  1. Usage of Screen.Activeform.ActiveControl - syntax
    By dcdimon in forum Programming
    Replies: 6
    Last Post: 06-17-2014, 09:05 AM

Tags for this Thread

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