Results 1 to 4 of 4
  1. #1
    jllbee is offline Novice
    Windows 10 Access 2003
    Join Date
    Apr 2019
    Posts
    1

    Query table for list box

    ok, I have a table that has Items in Rows and Style's in Colums:



    ITEM STYLE A STYLE B STYLE C STYLE D STYLE E STYLE F STYLE G STYLE H
    1 $1.00 $2.00 $3.00
    2 $2.00
    3
    4 $1.00 $3.00
    5
    6 $5.00 $6.00
    7 $1.00
    8
    9 $2.00 $3.00
    10 $1.00

    I have a form that has two list boxes:

    Click image for larger version. 

Name:	itemstyle.PNG 
Views:	19 
Size:	2.7 KB 
ID:	38182

    I want to Choose the Item and then have the Style Listbox only show Style's that have a price in them.
    This table has 406 Rows and 72 colums

    I can do this in excel, but i'm not a Access Programmer and using MS Access 2003.
    how do i build this query?

    Thanks in advance
    JL

  2. #2
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,973
    You have a spreadsheet layout which doesn't work well in Access
    Firstly you should redesign your table with 4 fields
    ItemID - autonumber PK
    Item - number
    Style - Text (1)
    Price - Currency

    You would then have several records for each item each with a price - 3 for item 1, 1for item 2, none for item 3 etc
    Then use cascading combo boxes where the second combo just has the style records for the item selected in the first combo.
    Trying to do this in Access with your design will be a nightmare. If you want that layout, use Excel
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  3. #3
    Peter M is offline Advanced Beginner
    Windows 7 64bit Access 2013 32bit
    Join Date
    Dec 2017
    Posts
    67
    I just re-read your post; you have 72 columns?
    You probably need a VBA script to convert this to a narrow-long table like Colin describes. (That could be done in either Excel or Access. If the column can be incremented or read programmatically I would use Access; otherwise I would use a copy & paste routine in Excel.)

    Below are the manual steps for a much smaller number of columns.
    ----

    If you want to convert your data into the table Colin describes you can use a Make Table query.

    For example:
    Select tbl_Excel and the field
    Item
    Style_A
    Amounts

    Append To tbl_Access
    Item
    Style
    Amounts

    Run that query, then edit the query so instead of selecting Style_A you select Style_B
    Repeat for all the styles.

    Then with a Long-Narrow table (Item, Style, Amounts) it is much easier to work in Access.
    To produce the output so it looks like your original table use a Cross-Tab query.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    If your Prices can change, you may want to design for that. You can not rely on the "current price" of the Item/Style, if/when you have to do any historical reporting or adjust any orders/invoices where there has been a Price change.

    Do your analysis and design before jumping too quickly into physical database.
    I agree with the other comments you have received, but I don't think you have fully described your requirement.
    Good luck.

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

Similar Threads

  1. Replies: 8
    Last Post: 12-13-2017, 10:38 AM
  2. Replies: 3
    Last Post: 01-11-2017, 03:18 PM
  3. Replies: 1
    Last Post: 09-10-2015, 04:19 AM
  4. When to use a value list instead of Table/Query?
    By wjgo in forum Database Design
    Replies: 1
    Last Post: 01-19-2012, 05:27 PM
  5. Value List vs. Table/Query Look Up
    By benthamq in forum Database Design
    Replies: 4
    Last Post: 09-12-2011, 01:35 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