Results 1 to 10 of 10
  1. #1
    kspabo is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2014
    Posts
    22

    Combo Box which selects from one table out of many


    So instead of having all of my data on a single table which is filtered out as I make selections in my initial 3 combo boxes, I'd like for each set of data to be on it's own table. Instead of filtering out the irrelevant data in a single table, I'd like the initial 3 combo boxes to instead filter out the irrelevant tables. My main reasoning for doing this is that I figure it would first off save me much trouble in the future when editing data within the tables and also that one huge data table would slow down Access eventually. It sort of just dawned on me that a Query may be the easiest way to do this, but I've yet to figure it out.

  2. #2
    SMC's Avatar
    SMC is offline Master Ninja
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Location
    Columbus, OH
    Posts
    28
    It might be helpful if you uploaded the part of the database that you need help with. It will make it more clear as to what exactly you are trying to filter out between tables.

  3. #3
    kspabo is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2014
    Posts
    22
    I've uploaded a barebones/very early version of my file for simplicity sake. What I'm trying to achieve is to have the selection of the Series in my third combo box filter which table appears in the fourth combo box. So a selection of let's say Sliding Series (SeriesID8) in the third combo box will now make tblData8 be my selection choices for the fourth combo box. I hope this helps.
    Attached Files Attached Files

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Why do you have 8 identical tables? Why not 1 table with another field for an identifier? Actually, think you already have that with the SeriesID field.

    Multiple similar name fields suggests a non-normalized data structure.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    kspabo is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2014
    Posts
    22
    The tables are identical for the sake of simplicity, I could upload my actual file which has 17 data tables each with it's own unique set of data if it would help.

    Are you suggesting that I create another table with an universal identifier from all 17 (2-8 in the case of the file I uploaded) data tables I need? That way when I make the selection in my 4th combo box it just references the actual table with the bits of information I need? My intentions here are simply to keep all the sets of data separated for ease of access/alteration and also to minimize the search load.

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Unique in what way? If the tables have the same fields, as shown in the example, then you have actually complicated the db with separate tables, not simplified.

    However, the code you seek could be like:

    Me.listboxLineSheet.RowSource = "SELECT * FROM [tblData" & Me.cboSeries & "]"

    Of course, could be more complicated if the actual table names are much different.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    kspabo is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2014
    Posts
    22
    Here is an example of the data I'm actually trying to use. Each data table does have it's own unique name.

    EDIT: I apologize for the images poor formatting, I expected it would resize to a more manageable size.
    Attached Thumbnails Attached Thumbnails screencap.jpg  

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Advise no spaces or special characters/punctuation (underscore is exception) in naming convention. Those are longest table names I've ever seen!

    Will need conditional structure in code.

    Dim strTable As String
    Select Case Me.cboSeries
    Case "this value"
    strTable = "this table name"
    Case "another value"
    strTable = "another table name"
    ...
    End Select
    Me.listboxLineSheet.RowSource = "SELECT * FROM [" & strTable & "];"

    Previous comments still apply. If fields are identical, separate tables unnecessarily complicates design.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    kspabo is offline Novice
    Windows 8 Access 2013
    Join Date
    Jun 2014
    Posts
    22
    Excuse the ridiculous table names it's a result of importing straight from excel without any name change. So just to clarify a question, since you're saying that tables with identical fields is essentially complicating the process, does this mean that if I were to consolidate all 17 data tables to a single table (since they have the same fields), would this reduce design complications? I just figured that separating sets of data to their own tables would simplify the process.

    Would you recommend that I consolidate all data tables to one large table, or should i try to figure out the code with individual tables?

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    One table. It is easier to apply filter to isolate records than it is to combine tables with UNION query. And at some point you will find a need to combine them, guarantee. In fact, a UNION query could serve as the RowSource for listbox and then simpler code to apply combobox value as filter parameter to the listbox.

    Also, if you have to add a new series, separate tables means design edits to create a new table then modify queries, forms, reports, code - real headache. With 1 table a new series just means new records.

    If you change the table names to something more along the lines of your original example or if the series name and table name are identical, the code could be simpler and more dynamic, as per my first example. However, a new series would still involve database design edits.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. 4 Selects, 1 Union
    By Perceptus in forum Queries
    Replies: 6
    Last Post: 12-27-2012, 03:46 PM
  2. Replies: 2
    Last Post: 11-30-2011, 08:44 PM
  3. Chain Selects
    By cff_moiseszaragoza in forum Access
    Replies: 2
    Last Post: 10-27-2011, 09:41 AM
  4. set focus selects all of the text
    By markjkubicki in forum Forms
    Replies: 3
    Last Post: 05-19-2011, 12:20 PM
  5. User selects pictures for report
    By NISMOJim in forum Reports
    Replies: 1
    Last Post: 10-29-2010, 03:06 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