Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 December 5th, 2004, 01:42 PM
Registered User
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Update Table fields

Please Help !
I made a access db with following tables:
Producs
Orders
OrderDetails
Customers
I can't update the stock field of products table when input a new order from orders form. For Example
I have a stock of 15 pcs for a product.A customer orders 5 pcs of this product.I am searching a way so when I input this order (in orders form) the stock field of table Products updates to 10 pcs(15-5)
I tried several ways to solve this problem (Vba ,Sql) but nothing.
I appreciate if you help me
Thank you in advance
P.S. If this help I can tell you more details or send a demo of my db

 
Old December 6th, 2004, 05:30 AM
Authorized User
 
Join Date: Jul 2003
Posts: 73
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Suspect that the record you are trying to update is a result of a join of tables where there Primary and Foreign keys are not truly unique and thus can't update.

Suggest that you run a UPDATE query using the unique index of the record in the OrderDetails table only.

Cheers Ray
 
Old December 7th, 2004, 03:48 PM
Registered User
 
Join Date: Nov 2004
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

update table Products from trigger for update on OrderDetails table:
 minus stock Products where Orderdetail.ProductID = inserted.ProductID

and plus from trigger for delete.







Similar Threads
Thread Thread Starter Forum Replies Last Post
update a fields value Vince_421 Access VBA 2 May 19th, 2006 06:41 AM
Problem to update fields cilla Classic ASP Databases 22 October 26th, 2004 07:36 AM
Update multiple fields. slgknjn Classic ASP Databases 6 February 15th, 2004 10:26 AM
fields from tables to update damnnono_86 Access 3 November 5th, 2003 04:07 AM





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