Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 5th, 2004, 01:42 PM
Registered User
 
Join Date: Dec 2004
Location: , , .
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

Reply With Quote
  #2 (permalink)  
Old December 6th, 2004, 05:30 AM
Authorized User
 
Join Date: Jul 2003
Location: Stockton on Tees, , United Kingdom.
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
Reply With Quote
  #3 (permalink)  
Old December 7th, 2004, 03:48 PM
Registered User
 
Join Date: Nov 2004
Location: , , .
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.


Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 04:00 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.