Solved update querry (1 Viewer)

sbaud2003

Member
Local time
Today, 07:17
Joined
Apr 5, 2020
Messages
178
how to make an update querry from the values in subform included in the main form
 

Minty

AWF VIP
Local time
Today, 02:47
Joined
Jul 26, 2013
Messages
10,366
Not enough information to give any sort of answer. Update what?
What have you tried?
Have you tried the expression builder in the query window, it helps you build references to loaded forms.
 

sbaud2003

Member
Local time
Today, 07:17
Joined
Apr 5, 2020
Messages
178
Not enough information to give any sort of answer. Update what?
What have you tried?
Have you tried the expression builder in the query window, it helps you build references to loaded forms.
Thanks for your prompt reply!!!!
I have a form name FrmSale and a sub form Invoice_details in which Item, Qty and Amount are specified. I want to run a update query to change the Stock in the table TblStock on entering the Item qty.
 

Minty

AWF VIP
Local time
Today, 02:47
Joined
Jul 26, 2013
Messages
10,366
Okay, that makes much more sense. However, you are possibly heading in a design direction that will almost certainly cause you a lot of problems.
Stock levels should always be calculated from transactions, never stored. So your sales quantities should be a sum of stock received records and stock sold records. These should simply be transaction records , and you calculate the stock from these records.

StockcodeLocationQtyTransactionDateTransactionType
RMR001010013-Jul-20Moved to Production
RMI004010013-Jul-20Moved to Production
RXC018310013-Jul-20Moved to Production
BAT00042526-Jun-20Goods Received
FHD00171124-Jun-20Stock Take
OLE00051324-Jun-20Stock Take
OLE00062024-Jun-20Stock Take
RMI000318024-Jun-20Stock Take

A lot more salient advice given here http://allenbrowne.com/AppInventory.html

 

sbaud2003

Member
Local time
Today, 07:17
Joined
Apr 5, 2020
Messages
178
Okay, that makes much more sense. However, you are possibly heading in a design direction that will almost certainly cause you a lot of problems.
Stock levels should always be calculated from transactions, never stored. So your sales quantities should be a sum of stock received records and stock sold records. These should simply be transaction records , and you calculate the stock from these records.

StockcodeLocationQtyTransactionDateTransactionType
RMR001010013-Jul-20Moved to Production
RMI004010013-Jul-20Moved to Production
RXC018310013-Jul-20Moved to Production
BAT00042526-Jun-20Goods Received
FHD00171124-Jun-20Stock Take
OLE00051324-Jun-20Stock Take
OLE00062024-Jun-20Stock Take
RMI000318024-Jun-20Stock Take

A lot more salient advice given here http://allenbrowne.com/AppInventory.html

where to call the function for getting stock at any time
 

Minty

AWF VIP
Local time
Today, 02:47
Joined
Jul 26, 2013
Messages
10,366
There are many ways to do this, depending on the number of records and stock codes you might have.
Personally I would build a query that returns a sum of all quantities and simply link that into whatever form you need to display it on.
 

Users who are viewing this thread

Top Bottom