Results 1 to 10 of 10
  1. #1
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265

    Northwind Sales Database: Form name property

    Pic attached. A few questions regarding the name property of a form:



    1. The Order Details form is currently selected. In the property sheet there is a property called name ("Order Detail"). In the upper window pane, the form name is preceded by "Form_." Why doesn't the "Form_" prefix appear in the form name in the property field?

    2. In form view, I select the "Order Details" form and press F4 to view its property sheet. In that version of the property sheet, I don't see a property called "name" like I do when I'm in the VBA editor. Why not?

    3. If I am in form view, and I still have the property sheet open, how could I tell what the form name is since there is not a field for the name property?

    4. I ran some code in Module 1 to display all form names. The results are displayed in the Intermediate window. There are a total of 34 forms, but in the upper left window pane, there are only 7 forms. Where are the other 27 forms?
    Attached Thumbnails Attached Thumbnails Northwinds Database.JPG  

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,932
    1. The Order Details form is currently selected. In the property sheet there is a property called name ("Order Detail"). In the upper window pane, the form name is preceded by "Form_." Why doesn't the "Form_" prefix appear in the form name in the property field?
    because it is indicating the appropriate module - also one of the reason I don't like using spaces or underscores - they are used in this situation but your form 'order details' has a space - in the code, if you were to reference it you woud do so as 'Form_Order_Details' - i.e. the space is replaced with an underscore.
    2. In form view, I select the "Order Details" form and press F4 to view its property sheet. In that version of the property sheet, I don't see a property called "name" like I do when I'm in the VBA editor. Why not?
    properties belong to the form, vba is a language - you would refer to the form property with the me.name or forms![order Details].name

    3. If I am in form view, and I still have the property sheet open, how could I tell what the form name is since there is not a field for the name property?
    see above
    4. I ran some code in Module 1 to display all form names. The results are displayed in the Intermediate window. There are a total of 34 forms, but in the upper left window pane, there are only 7 forms. Where are the other 27 forms?
    if you used the code which is commented out, you are only listing the forms that are loaded (if obj.isloaded=true...)

  3. #3
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by Ajax View Post
    because it is indicating the appropriate module - also one of the reason I don't like using spaces or underscores - they are used in this situation but your form 'order details' has a space - in the code, if you were to reference it you woud do so as 'Form_Order_Details' - i.e. the space is replaced with an underscore.
    properties belong to the form, vba is a language - you would refer to the form property with the me.name or forms![order Details].name

    see above
    if you used the code which is commented out, you are only listing the forms that are loaded (if obj.isloaded=true...)
    I forgot to mention that when I ran the code that is now commented out, I did comment out the "obj.isloaded=true" part so that all forms (open or closed) will be listed. When I viewed the results in screen shot in the Intermediate window, I counted 34 forms. But in the Project Window, only 7 forms are showing. What happened to the other 27 forms?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Quote Originally Posted by Access_Novice View Post
    But in the Project Window, only 7 forms are showing. What happened to the other 27 forms?
    The view you show above only shows forms with VBA code behind them. Presumably the 27 others do not.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    But in the Project Window, on 7 forms are showing. What happened to the other 27 forms?
    Is this a test?? I don't do well on tests!


    Probably..... the other 27 forms do not have code behind the forms.

    Open a form in design view, click on the OTHER tab and look for the "Has Module" property. If it is NO, add a procedure.... something like the form open event. Doesn't have to have any VBA code, just create a procedure. Save the form, then look for the form in the project window.

  6. #6
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by pbaldy View Post
    The view you show above only shows forms with VBA code behind them. Presumably the 27 others do not.
    It's been a few months since I have worked with Access. I honestly don't remember form names having these types of notations such as "Form_" preceding the form name. Maybe it has something to do with what you said about having VBA code behind them. How would you change the view so that all forms are shown, whether they have VBA code behind them or not?

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    form names having these types of notations such as "Form_" preceding the form name.
    The "Form_" is how ACCESS refers to form. You shouldn't use that prefix.

    In the IDE, The form names will only "show up" if they have code modules. (BTW, Forms that do not have code are also known as light weight forms.)


    How would you change the view so that all forms are shown, whether they have VBA code behind them or not?
    You cannot "change the view". A form MUST have code attached to be displayed in the IDE.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Quote Originally Posted by Access_Novice View Post
    It's been a few months since I have worked with Access. I honestly don't remember form names having these types of notations such as "Form_" preceding the form name. Maybe it has something to do with what you said about having VBA code behind them. How would you change the view so that all forms are shown, whether they have VBA code behind them or not?
    why not use the navigation pane rather than the VBA editor?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    Access_Novice is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2013
    Posts
    265
    Quote Originally Posted by ssanfu View Post
    The "Form_" is how ACCESS refers to form. You shouldn't use that prefix.

    In the IDE, The form names will only "show up" if they have code modules. (BTW, Forms that do not have code are also known as light weight forms.)

    You cannot "change the view". A form MUST have code attached to be displayed in the IDE.
    On the following page (http://allenbrowne.com/casu-04.html) they use Forms.Students.Surname to refer to a form called students. In the project window, all form names are preceded by "form_" before the name of the form.

    How can they use the Forms.Students.Surname notation to refer to a form called Students even though they are leaving out the "form_" part?

    I am very sure that I have referred to controls by using FormName.ControlName, which in this case would be Students.Surname.

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    You have gotten a lot of info from Paul and Steve. Here is another reference to info re referencing forms and controls.

    But you can test some of the info that has been given and "see for yourself".

    Also, I saw in your original jpg, a line referring to allModules.

    This is how I get a list of module names, but I'm sure there are many others--just as good or better.
    Code:
    '---------------------------------------------------------------------------------------
    ' Procedure : modstuff
    ' Author    : mellon
    ' Date      : 5/09/2006
    ' Purpose   : Routine to print all module names
    '---------------------------------------------------------------------------------------
    '
    Sub modstuff()
        Dim db As DAO.Database
        Dim myObj As Object, obj As Object, iCnt As Integer
        Dim iModCnt As Integer
    10    On Error GoTo modstuff_Error
    
    20    Set db = CurrentDb
    30    Set myObj = Application.CurrentProject
    40       iModCnt = myObj.AllModules.Count
    50    For Each obj In myObj.AllModules
    60      iCnt = iCnt + 1
    70      Debug.Print iCnt & "  " & obj.name
    80    Next obj
    
    90    On Error GoTo 0
    100   Exit Sub
    
    modstuff_Error:
    
    110   MsgBox "Error " & Err.Number & " in line " & Erl & " (" & Err.Description & ") in procedure modstuff of Module AWF_Related"
    End Sub
    Good luck.

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

Similar Threads

  1. Replies: 1
    Last Post: 07-30-2015, 07:53 AM
  2. Replies: 2
    Last Post: 06-22-2014, 10:26 AM
  3. Northwind access database help
    By ianhaney28 in forum Access
    Replies: 1
    Last Post: 03-28-2014, 11:48 AM
  4. Property sales and rentals project
    By dannybhoy in forum Database Design
    Replies: 11
    Last Post: 02-22-2011, 02:30 AM
  5. Help with Database from Northwind
    By jpl85716 in forum Access
    Replies: 2
    Last Post: 09-24-2010, 08:35 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