Results 1 to 10 of 10
  1. #1
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17

    Thumbs up How To get a spesific Item Price From a Table


    Hi,

    I have two Tables . Customers and Items.
    In the Items Table I have multiple Selling Prices for each Item.(Whole sale Price, Cash Price,,,,)
    In Customer Table I have a field which indicates what kind of price I will sale to him.
    When I am selling an item to the customer I Would like to pup up the correct selling Price.

    Pls Help

    Thank in Advance

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Need to know more about data structure.

    These prices are in separate fields? How many are there?

    Items table is the table with pricing information?

    What table has item sales records?
    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.

  3. #3
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17
    The Prices are in 5 Different fields(Selling_Price1 , Selling_Price2...)
    I have also Sales-Header Table (Fields [Invoice_no] [invoice_date] [Customer_code])
    and Sales-Details Table (fields([Item-Code] [Qty sold] And [Selling Price])
    When I type the Item Code In a Combo box i Get also all the information from the Item Table.
    I need to get the correct price for the specific customer

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Are SalesHeader and SalesDetails set up as form/subform?

    Include the Customers table in the RecordSource of form for SalesHeader, join type "Include all records from SalesHeader and only those from Customers that match.

    Include the Prices table in the RecordSource of form for SalesDetails, join type "Include all records from SalesDetails and only those from Prices that match.

    Expression in textbox named Type on SalesDetails form to retrieve the pricing type.

    =Forms!SalesHeader!PriceType

    Expression in textbox on SalesDetails form to retrieve price:

    =Switch([Type]="Wholesale", [Selling_Price1], [Type]="Cash", [Selling_Price2], etc)
    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
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17
    The SalesHeader and SalesDetails set up as form/subform

    Include the Customers table in the RecordSource of form for SalesHeader, join type "Include all records from SalesHeader and only those from Customers that match.
    I did not understand it.
    Relationship between Customers Table and Sales Header Table connected with Price_Type Field???

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Aren't Customers table and SalesHeader related by CustomerID?

    I am suggesting RecordSource for the forms be a query that joins tables. Are you familiar with queries that join tables? Basic functionality of relational database.

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17

    Help

    SCS_SYSTEM.zip


    Dear June7

    Pls Find Attached my DB. The main idea is that
    an Item has multiple selling prices(Selling_price1...) and the customers has predefine what type of Selling price will buy the products.

    When I choose the item in the subform the correct price will pop up.
    Thanks

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    The PriceType fields in Items table are useless.

    RecordSource for Frm_Invoices_Header
    SELECT [Invoices-Header].*, Customers.Price_Type
    FROM Customers RIGHT JOIN [Invoices-Header] ON Customers.Customer_Code = [Invoices-Header].Customer_Code;

    Barcode is primary key in Items but Item_Code is saved as foreign key in Invoices_Details. The primary key should be saved as foreign key. Either make Item_Code the primary key or save the barcode into Invoices_Details.

    RecordSource for Frm_Invoices_Details
    SELECT [Invoices-Details].*, Items.Selling_Price1, Items.Selling_Price2, Items.Selling_Price3, Items.Selling_Price4, Items.Selling_Price5
    FROM Items RIGHT JOIN [Invoices-Details] ON Items.Item_Code = [Invoices-Details].Item_Code;

    Expression in Type textbox on Frm_Invoices_Details
    =[Forms]![frm_Invoices_Header]![Price_Type]

    Expression for the pricing in Text20
    =Switch([Type]="P1",[Selling_Price1], [Type]="P2",[Selling_Price2], [Type]="P3",[Selling_Price3], [Type]="P4",[Selling_Price4], [Type]="P5",[Selling_Price5])
    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
    LOIZOS is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2014
    Posts
    17
    Thanks
    Is Working OK!!!

  10. #10
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Loizos,

    When you see fields such as Price_Type1,Price_Type2,Price_Type3...Selling_Pric e1,Selling_Price2,Selling_Price3, it begs for Normalization.
    You may find these videos of interest.

    http://www.youtube.com/watch?v=IiVq8M5DBkk Logical data modeling

    http://www.youtube.com/watch?v=BGMwuOtRfqU Candidate key

    http://www.youtube.com/watch?v=ZiB-BKCzS_I Normalization

    http://www.youtube.com/watch?v=pJ47btpjAhA Normalization example

    http://www.youtube.com/watch?v=q3Wg2fZENK0 1st Normal form

    http://www.youtube.com/watch?v=vji0pfliHZI 2nd Normal form

    http://www.youtube.com/watch?v=HH-QR7t-kMo 3rd Normal form

    http://www.youtube.com/watch?v=q1GaaGHHAqM E_R Diagramming

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

Similar Threads

  1. Replies: 5
    Last Post: 11-07-2013, 12:17 PM
  2. Item without price, or duplicate price
    By Auto in forum Reports
    Replies: 5
    Last Post: 07-29-2013, 09:46 PM
  3. Parent Item / Child Item Not Saving Correctly Together
    By Evilferret in forum Programming
    Replies: 6
    Last Post: 08-24-2012, 02:30 PM
  4. find price in a table
    By bill1138 in forum Queries
    Replies: 2
    Last Post: 12-28-2011, 12:44 PM
  5. Replies: 5
    Last Post: 07-29-2011, 12:55 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