Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    Bournemouth, England
    Posts
    29

    Cool Unanswered: SQL Update Statement

    Hello I would be very grateful if someone could help me fix this problem, It been floating aroung this forum for a while with no solution.

    Ill Start from the top.

    I have a database that stores Orders, Customers and Products. From this information I can calculate Estimated value of order, see how many of each product is on order(The problem) and produce various reports.

    What I want to do.... I have a combo box that is filled by the products table, when one of the products is selected I want an SQL statement the finds the relevent product in the products table and adds 1 to the stock needed field. I know i need some sort of SQL statement, possibly something like:

    SQLStrg = "UPDATE Products SET Products.StockNeeded = Products.StockNeeded + 1 " WHERE Products.ProductID = comboProductID.column(1)"

    comboProductID.column(1) is the location in the combo box where the producID is stored.

    It seems simple but I just cant get it to work ive been working on this for a while now please could someone help.

    I have attached my database and would welcome any advice or modification.

    Thanks Chris.
    Attached Files Attached Files

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346
    You misplaced your double-quotations. Change this line:

    Code:
    SQLStrg = "UPDATE Products SET Products.StockNeeded = Products.StockNeeded + 1 " WHERE Products.ProductID = comboProductID.column(1)"
    to this:

    Code:
    SQLStrg = "UPDATE Products SET Products.StockNeeded = Products.StockNeeded + 1 WHERE Products.ProductID ='" &  comboProductID.column(1) & "'"
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •