Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old November 27th, 2003, 06:45 AM
grms78 grms78 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 4 grms78 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation ms access trigger

I'am developing an ms access database for oders and inventory control. I'am trying to find a way to update the inventory table every time someone place an order.
Can someone please help me?

Reply With Quote
  #2  
Old November 27th, 2003, 08:29 AM
TBÁrpi's Avatar
TBÁrpi TBÁrpi is offline
Lazy User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Hungary, Europe
Posts: 337 TBÁrpi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 5 m 5 sec
Reputation Power: 5
Send a message via MSN to TBÁrpi Send a message via Yahoo to TBÁrpi Send a message via Skype to TBÁrpi
Hali,

As I understood you need to keep track of the inventory ie. the stock supply. Is this correct?
If so, a solution can be the following:

Generally, it needs two tables, one for the Orders and the other for the goods received to stock.
- When someone place an order, then you append a new record to the Orders table.
- When something enters to the stock then you append a new record to the inventory table.

1. Write a query working on the orders table and sums the quantity ordered, and groups the result rows by goods. Something like this:

SELECT
GoodID,
Sum(Qty) as SumOfOrder
FROM
tblOrder
GROUP BY
GoodID

2. Write a query working on the Inventory table that sums the quantity received to stock, and groups the result rows by goods. Something like this:

SELECT
GoodID,
Sum(Qty) as SumOfEnter
FROM
tblInventory
GROUP BY
GoodID

3. Then write a query that links these queries on GoodID, then it will always show you the current level of each good on stock. Something like this:

SELECT
EnterQuery.GoodID,
EnterQuery.SumOfEnter as Qty_Ordered,
iif(isnull(OrderQuery.SumOfOrder),0,OrderQuery.Sum OfOrder) as Qty_Entered,
EnterQuery.SumOfEnter - iif(isnull(OrderQuery.SumOfOrder),0,OrderQuery.Sum OfOrder) as Balance
FROM
EnterQuery LEFT JOIN OrderQuery
ON
EnterQuery.GoodID = OrderQuery.GoodID

The reason of including iif function is that in the left-join query above the SumOfOrder field may be Null and this can cause a run-time error of 'Invalid use of Null'. You should use the lef-join, because if you have a good on stock, it might be never ordered (newly launched product, for example), and if you don't use the left-join, then you won't see the goods that have never been ordered, but you do have on stock.

I haven't run a syntax check on the queries abve so you may get syntax error, but I don't think that you will.

I hope this helps you.

BRegs,

TBÁrpi

Reply With Quote
  #3  
Old December 2nd, 2003, 05:16 AM
grms78 grms78 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 4 grms78 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb

Thank you for your tme!!!
You helped me alot in solving my problem!


Best Regards
grms78

Reply With Quote
  #4  
Old December 11th, 2003, 04:13 PM
sandipt sandipt is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 14 sandipt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Inventory or Stock calculation

grms78
Is it possible to post sample database you have created for Inventory because I am working on same but could not understand this coding
Sandip

Reply With Quote
  #5  
Old December 12th, 2003, 04:47 AM
grms78 grms78 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 4 grms78 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Inventory Control

Finally i didn't use the code.
I'm thinking of using macros with update queries but i am not sure yet if it works.
If it works i will send you the database.

grms78

Reply With Quote
  #6  
Old December 12th, 2003, 10:42 AM
sandipt sandipt is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 14 sandipt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Inventory

Hi grms 78
Thanks
I willwait but keep me inform or let me know what other problems in this you are facing
Sandip

Reply With Quote
  #7  
Old December 16th, 2003, 07:37 AM
grms78 grms78 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 4 grms78 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

Hi Sandip

I'm not sure yet but if we use update queries inside macros on afterupdate event of the fields in orders form maybe will work.
For example the query must much the Orders productID with the Inventory productID with the cryteria [Forms]![Orders]![productID]=[Forms]![Inventory]![productID].
Then another cryteria in the same query will minimize the inventory of the specific products. [Forms]![Inventory]![inventory]-[Forms]![Orders]![quantity]

The above rows will be written in the cryteria line in the design view of the update query.

I will keep working on it!

Sorry about my english i know that they are not so good!
grms78

Reply With Quote
  #8  
Old December 16th, 2003, 06:22 PM
sandipt sandipt is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 14 sandipt User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question

Hi grms 78
Thanks
but as i said i am not very good in coding part so could not understood much but i will also work on it, for your information when I was working on sample databases of microsoft office i found one sample database with inventory control (its exe file and if you click onit it creates database (all tables and forms and reports for Inventory controll).See if its useful to you
Sandip

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > ms access trigger


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway