Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 9th, 2005, 07:35 AM
Authorized User
 
Join Date: Mar 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default Smart ideea needed

Hello, everybody! I need a simple and smart solution for this case:
I have two tables: Products, with ProductID and NeededQty fields, and SupplierStocks with 6 fields : ProductID, StockA, StockB, StockC,StockD, StockE. Every product from Products table can be bought from 5 suppliers: A, B, C, D ,E in this order of prefference. If the quantity needed for a product exceeds the supplier "A" Stocks, the rest must be bought from supplier "B". If the quantity needed exceeds "A+B" stocks, the rest will be bought from supplier C etc... I have to fill a third table (OrderPlace, with 6 fields -ProductID, OrderA,OrderB,OrderC,OrderD,OrderE) with quantity to order from each suplier for each product. Thank you in advance!

 
Old September 9th, 2005, 09:48 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

crisan,

Do you use VBA?
How often are you going to run this process?
Are you going to also want to decrease the SupplierStocks Table values when you do this?
Is the OrderPlace table going to hold just this order?

This can be written in VBA pretty simply, but need more info.

Kevin

dartcoach
 
Old September 10th, 2005, 06:29 AM
Authorized User
 
Join Date: Mar 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Dartcoach,
1.I don't have any prefference in solving this issue, can be a querry or VBA code as well.
2.This application will be run twice a day, every day.
3.No, I don't have to update the stocks level in this application.
4.Yes, the OrderPlace will hold just this order.
Thank you!

 
Old September 10th, 2005, 06:35 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Crisan,

1. How long will you be there today?
2. Could you send me some test data?
3. Will this be run from a form, I.E. a command button?

Kevin

dartcoach
 
Old September 10th, 2005, 06:58 AM
Authorized User
 
Join Date: Mar 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Kevin, this will be run from a button.

TEST DATA.
Products table:
PID NeededQty
AM002C 400
AM003C 520
AM004B 335
AM005R 500


SupplierStocks.
PID StockA StockB StockC StockD StockE
AM002C 230 200 120 500 200
AM003C 600 400 500 550 500
AM004B 0 0 120 400 0
AM005R 150 160 300 260 0

After running the code, OrderPlace table should look like this:
PID OrderA OrderB OrderC OrderD OrderE
AM002C 230 170 0 0 0
AM003C 520 0 0 0 0
AM004B 0 0 120 215 0
AM005R 150 160 190 0 0


 
Old September 10th, 2005, 07:00 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Crisan,

Working on it as we speak, should have something in an hour.

Kevin

dartcoach
 
Old September 10th, 2005, 07:29 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Crisan,

Quick question, is your product Id autonumber, number or text?

Kevin

dartcoach
 
Old September 10th, 2005, 08:02 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Crisan,

I've got the code working, but depending on the format of your ProductID, it may not work in your system. I can't go any further until you get back to me.

Kevin

dartcoach
 
Old September 10th, 2005, 08:16 AM
Authorized User
 
Join Date: Mar 2005
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Kevin, these PID's are text type. The only important thing I forgot to mention is that PID is Primary Key in each of these 3 tables.

 
Old September 10th, 2005, 08:18 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Crisan,

That's not a problem. I will be back to you in a few minutes.

Kevin

dartcoach





Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting certificate off smart card kuznickic C# 2005 1 June 16th, 2006 11:24 AM
dynamic smart tag Medes VS.NET 2002/2003 0 April 13th, 2006 12:59 PM
Smart navigation Baby_programmer ASP.NET 1.0 and 1.1 Basics 2 August 31st, 2004 06:28 AM
smart device extensions aadz5 C# 0 January 7th, 2004 05:16 PM
Smart Error Traping Ned Pro VB 6 4 September 11th, 2003 05:01 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.