Chat with a LIVE Microsoft Access Expert!
 
       
 

         

   

Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
 
Chat with a LIVE Microsoft Access Expert!
Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-04-2005, 01:32 PM
sevenair sevenair is offline
Registered User
 
Join Date: Apr 2005
Posts: 6
sevenair is on a distinguished road
Update Qry always updates to Zero

Hey,
im trrying to build a stock control system for a small store, and im having a nightmare trying to gert the updatestock query to work. It is an update query, and it does update this, the only thing is, no matter how many i sell on a day, it always sets the InStock to Zero.

Basically, I have a Sale table, which records the ProductID, and Quantity. I also have a Stock table, with an InStock value. I want to take a SumOfSale and then a this to he InStock value in the Stock table.

I couldnt make a query to automatically update stock as I make a sale, so i thought I could just take a tally of how many i sell a day (sumofsalequantity), and then deduct this from the InStock at the end of the day, but this isnt working Sad

Does anyone know why it would reset the InStock to zero, regarless of how many is in stock?? r can you avise me on where to get help, ive tried everything, been reading all the manuals, and im at my witts end now

Any advice would e much much appreciated Smile
Reply With Quote
Sponsored Links
  #2  
Old 04-05-2005, 09:43 AM
FoFa's Avatar
FoFa FoFa is offline
Registered User
 
Join Date: Jan 2003
Location: Texas, USA
Posts: 3,580
FoFa is on a distinguished road
Assumption:
Sales Table:
Date
Qty Sold
Stock Number

Stock Table:
Stock Number
Qty on hand

UPDATE STOCK TABLE
SET Qty on hand = Qty on hand - Qty sold
inner join Sales Table on Sales Table.Stock Number = Stock Table.Stock number Where Date = xx/xx/xxxx

That is not sytatically correct, it is to give you an idea of what you should be looking for.

You could sum the qty sold by stock number, but then you can't use it in a update query. So this is a better way for small amounts of data which it sounds like you have.
Reply With Quote
Sponsored Links
Reply

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 04:48 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
(c) copyright 2009 Access World