Results 1 to 10 of 10
  1. #1
    tristangemus is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    11

    Drop Down Menu Linking To Tables


    I am creating a database storing purchase information for numerous machines. I have created tables for each machine which inside stores that information. I would like to create a splash form to display some sort of drop down menu (such as combo box) to list the forms so once clicked they will be brought to that form. Is there any way to do that? Or any better way? I am trying to avoid having to create buttons one by one for each machine since there are over 100 of them. Thank you.

  2. #2
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    1) Are these tables all similar, or are they very different from one another? Typically, if they all had mostly the same kind of information, then you'd just have one combined table which had a "type" field for what kind of machine it was, then the other fields. If there were some kinds of machines that had very different information, then you might have an additional table for all the unique fields.

    2) If not, then you could easily create a new "tblSplashindex" table that has machine-type, form-name as columns, and load that into a combobox cbxSplashIndex. In the AfterUpdate of cbxSplashIndex, you'd use DoCmd.OpenForm to open the form for that machine.

  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
    Place a Combobox on your Form. When the Combobox Wizard comes up, click Cancel.

    Right-Click on the Combobox and go to Properties – Other and change the Name Property from the one Access assigned to cboFormOpen.

    Now go to the Data Tab and paste this into the RowSource Property:

    Code:
    SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") And (MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;


    Then use this code

    Code:
    Private Sub cboFormOpen_AfterUpdate()
      stDocName = Me.cboFormOpen
      DoCmd.OpenForm stDocName
    End Sub


    When you make a selection the chosen Form should Open.

    Linq ;0)>

  4. #4
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    linq - does your code assume that each form to be opened is named precisely after the machine that it is intended to affect? I assumed a tblSplashIndex would be needed to relate those two items.

  5. #5
    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
    That RowSource pulls all Forms in the Database.

    Linq ;0)>

  6. #6
    tristangemus is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    11
    Thanks for the input link. Where am I putting the last bit?

    Code:
    Private Sub cboFormOpen_AfterUpdate()
      stDocName = Me.cboFormOpen
      DoCmd.OpenForm stDocName
    End Sub
    Quote Originally Posted by Missinglinq View Post
    Place a Combobox on your Form. When the Combobox Wizard comes up, click Cancel.

    Right-Click on the Combobox and go to Properties – Other and change the Name Property from the one Access assigned to cboFormOpen.

    Now go to the Data Tab and paste this into the RowSource Property:

    Code:
    SELECT MSysObjects.Name FROM MsysObjects WHERE (Left$([Name],1)<>"~") And (MSysObjects.Type)=-32768 ORDER BY MSysObjects.Name;


    Then use this code

    Code:
    Private Sub cboFormOpen_AfterUpdate()
      stDocName = Me.cboFormOpen
      DoCmd.OpenForm stDocName
    End Sub


    When you make a selection the chosen Form should Open.

    Linq ;0)>

  7. #7
    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
    In the Code Module for the Form that contains the Combobox.

    Linq ;0)>

  8. #8
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    OKay, so trist - that code assumes that the user can tell, from just the name of the form, what machine the form is related to. If that's the case, use linq's method. If not, you'll have to either rename the forms to make that happen, or build a table with that information, as I suggested.

  9. #9
    tristangemus is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2013
    Posts
    11
    Quote Originally Posted by Dal Jeanis View Post
    OKay, so trist - that code assumes that the user can tell, from just the name of the form, what machine the form is related to. If that's the case, use linq's method. If not, you'll have to either rename the forms to make that happen, or build a table with that information, as I suggested.
    Is there a way for the DB to automatically group them into one form? I require them in seperate tables for organization purposes. And we are constantly adding new parts so if it were to automatically update the big list from the individual one then I would go with that.

  10. #10
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    I have no way of knowing without a lot more detail about how you are already set up. If the tables all have a naming convention in common, like they all start with a prefix, then you could load a drop-down box with the table names using code very similar to linq's post #3, and let the user select the appropriate table from a single form.

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

Similar Threads

  1. Plus minus drop down menu
    By ashu.doc in forum Forms
    Replies: 3
    Last Post: 08-09-2012, 10:04 PM
  2. Drop Down Help Menu
    By dandoescode in forum Access
    Replies: 1
    Last Post: 08-07-2012, 02:51 AM
  3. Drop down menu help
    By whojstall11 in forum Access
    Replies: 6
    Last Post: 03-07-2012, 01:51 PM
  4. Replies: 3
    Last Post: 11-29-2011, 07:01 AM
  5. Drop Down Menu Parameters
    By spoonman in forum Programming
    Replies: 5
    Last Post: 08-18-2011, 02:16 PM

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