Results 1 to 10 of 10
  1. #1
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376

    Where's Used based on 100 + tables


    Hello all,
    I have a database that I have developed over the last 3 years or so that works great but I want to add functionality to it. I want to do a where's used report and have the report tell me in what different products any given part number is used. I have 101 different tables (BOM's) and I want to to able to input a part number and have the query go thru each table and indicate the Parent Item and the Part Number in question with the Qty.

    How would I go about this?

    I did have this functionality previously but just used 1 table but this was abandoned because of the time it took to look things up but that was also running across a network which I now run locally then once a week copy the BE file over to the network.

    Thanks in Advance

    Dave

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    WHY are there 100 tables? this seems wrong.

    youd need to program a routine the go thru each table to produce a query to load the results to the tResult table.
    a form would have the search item: txtFind
    then the code would query all the tables
    either use a list of the tables,
    or
    cycle thru the table names to get only Bom tables (my example)

    put all results into the tResult table
    Code:
    dim tdf as tabledef
    dim db as database
    dim sSql as string
    Code:
    docmd.Setwarnings false
    set db = currentdb
    for each tdf in db.tabledefs
        'get the Bom tbl
       if instr(tdf.name ,"Bom")>0 then
         sSql = "Insert into tResults Select * from " & tdf.name & " where [name] = '" & me.txtFind & "'"
         docmd.runSql sSql
    next 
    docmd.Setwarnings true
    docmd.Opentable "tResults"
    

  3. #3
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    I agree with Ranman, you shouldn't have a table per BOM?

    That's a fundamental design problem.
    Every time you add a new BOM you create a new table, then have to add or change your forms queries etc. to accommodate it?
    That isn't correct.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    Can you not merge all the tables into 1 Bom?

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Dave,

    Further to ranman's advice, please describe exactly what you need. Is it a field/control name where used or the value of specific data?

  6. #6
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376
    So you both recommend going back to a single BOM table. I could take the time to create a new tblBOM and then append all of the individual ones to that one. That did work but became extremely slow over the network.

  7. #7
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    If network speed was a concern then maybe the forms displaying the data need to be designed to pull less data through when they load?

    Could you show us the current table designs?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  8. #8
    Dave14867's Avatar
    Dave14867 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Location
    Upstate NY
    Posts
    376
    Unfortunately I cannot post much, I may create a dummy table to illustrate what I am working with. Most tables (Bom's) have 2 to 12 items. The speed really became an issue, running it locally solved all of that.

  9. #9
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    A dummy version would help.

    I'm just doing some basic maths 100 ish BOM's with max 12 lines is only 1200 records?
    I'm struggling to see how can that be slow?

    I suspect there was something else causing this performance issue?
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  10. #10
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    usual design culprits for poor performance are lack of normalisation, lack of indexing, forms/reports based on whole tables and filtered rather than applying criteria before fetching the data. The openform command misleadingly has a WHERE parameter which implies criteria but actually, its a filter.

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

Similar Threads

  1. Replies: 4
    Last Post: 12-18-2019, 02:57 AM
  2. Replies: 4
    Last Post: 08-24-2016, 06:48 AM
  3. Replies: 3
    Last Post: 07-26-2016, 02:12 PM
  4. Replies: 6
    Last Post: 10-29-2015, 03:33 PM
  5. Form based on two tables
    By maciej_wroclaw in forum Forms
    Replies: 1
    Last Post: 03-13-2012, 06:26 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