Results 1 to 4 of 4
  1. #1
    psmaglik is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2018
    Posts
    2

    Complex query that is getting inofrmation from a form

    I have been trying to design a query that requires input from a form that I have create:



    Here is the form see attachment form01.jpg

    Here is the query that I am building see attachment query01.jpg


    Here is the parameter that I am using for Product Name: This works this looking for the product that has a check mark to display that product in the query.
    IIf([Forms]![FRMProductName]![Check8],"CHL1- Hamilton Adirondack Chair") Or IIf([Forms]![FRMProductName]![Check11],"CHL1- Hamilton Adirondack Chair- Two Tone")


    Here is the parameter that I am using for the QTY01 - Expression Field:
    QTY01: Switch([Forms]![FRMProductName]![QTY01]>=1,[Forms]![FRMProductName]![QTY01]*[TBL_Product]![BP01],[Forms]![FRMProductName]![QTY02]>=1,[Forms]![FRMProductName]![QTY02]*[TBL_Product]![BP01])

    The problem that I am having is when I type in the QTY field the second box on the form and the first one has a value it is taking the first result and multiplying against the QTY01:Expression. I am hoping I am explaining it right.

    I need some to point me in the right direction on how should I write the query I have banged my head at my desk for days on this issue.

    Paul
    Attached Thumbnails Attached Thumbnails Query01.jpg   Form01.jpg  

  2. #2
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    I think you have an inherent design problem, you shouldn't have qty1 and qty2 as fields. If you suddenly need qty3 you are into a re-write of you system.

    You should have a table containing Order or BOM lines with a ProductD field and a qty field, this should be linked back to an d order header storing the order date and who the order is for.
    This way you have as many or as few related qty lines as you need and your querying becomes simple.
    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 ↓↓

  3. #3
    psmaglik is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Oct 2018
    Posts
    2
    Here are my tables and relationships.
    Click image for larger version. 

Name:	relationships.jpg 
Views:	9 
Size:	84.4 KB 
ID:	35696Click image for larger version. 

Name:	TBL_Lumber.jpg 
Views:	9 
Size:	134.2 KB 
ID:	35697Click image for larger version. 

Name:	TBL_Product.jpg 
Views:	9 
Size:	172.4 KB 
ID:	35698

    What I am trying to achieve is to create a query that will require the user to select a product and type in the QTY on the form and then I want the query to total all the pieces of lumber that is needed. A lot of our products use the same type of lumber so what I am trying to achieve is a lumber calculator.

  4. #4
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,157
    You have what somebody on here describes unfortunately accurately as "Committed Spreadsheet".

    You have taken a spreadsheet design and pretty much dumped it into a table. It won't work.
    You need to read up about normalisation.

    Start here https://www.fmsinc.com/microsoftacce...transpose.html
    and google lots !
    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 ↓↓

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

Similar Threads

  1. Replies: 11
    Last Post: 07-24-2017, 07:06 PM
  2. Form-based parameter query too complex?
    By FinChase in forum Forms
    Replies: 10
    Last Post: 06-09-2015, 11:03 AM
  3. Query to complex....
    By zero3ree in forum Access
    Replies: 2
    Last Post: 03-21-2013, 09:17 AM
  4. Replies: 7
    Last Post: 09-12-2011, 12:03 PM
  5. Help with complex Query
    By CEV in forum Queries
    Replies: 1
    Last Post: 03-12-2011, 06:54 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