Results 1 to 3 of 3
  1. #1
    LorraineM is offline Novice
    Windows 8 Access 2013
    Join Date
    Nov 2015
    Posts
    1

    Cool Update Queries

    Hi, I am currently creating a database in Access 2013 for a bookshop. I am trying to do an update query where when a new order is made from the store and an item of stock is bought the stock amount is updated to reflect the change in stock. The two tables that I am trying to do this from are tblNewSale and tblInventory, tblNewSale shows when a new order is placed and tblInventory shows all of the stock we currently have in the store. I am really unsure of how to do this and any help would be really appreciated!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Do you only have two tables in the database? A bound form can update records in tblNewSale. For instance, a control on the form could be bound to the appropriate field to indicate the quantity ordered/sold. From there, you can use an action query to update the appropriate record in tblInventory. Before running an update, you will want to validate your data and make sure the quantity desired is available in inventory.

    You might use a DLookup() function to validate your data before executing a query to update. You would use variables within your Form's Recordset for your code. The SQL statement might look something like ...
    Code:
    UPDATE tblInventory SET tblInventory.QtyOnHand = 4
    WHERE (((tblInventory.PrimaryKey)=14523));

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,850
    There are some tutorials and videos here that deal with Customers, Orders and Items. Watching these may be very helpful when building your database.

    A great reference on inventory and quantity on hand

    Good luck.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Update queries
    By ezz in forum Access
    Replies: 4
    Last Post: 01-04-2015, 06:16 PM
  2. Update queries sometimes very slow
    By GregL65R in forum Programming
    Replies: 3
    Last Post: 12-05-2013, 05:42 PM
  3. Update more queries with the same parameters
    By Christian1977 in forum Programming
    Replies: 4
    Last Post: 06-28-2013, 02:57 AM
  4. IIF Statements and Update Queries.
    By nicknicknick in forum Queries
    Replies: 1
    Last Post: 06-05-2011, 12:08 PM
  5. Need help with update query / queries
    By Wayne2072 in forum Queries
    Replies: 1
    Last Post: 05-24-2010, 01:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums