Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Aug 2005
    Thanked 0 Times in 0 Posts

    update query (Access 2000)

    Can you help me with the error in query for updating a field in a subform.
    The query i have is the following :

    UpdateCartons = "UPDATE Products SET products.branch0 = products.branch0 - Me! cartons "
    DoCmd.RunSQL "Updatecartons"

    There must be some errors in it.I am also applying the database

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: update query (Access 2000)

    You cannot use Me! in an SQL string. You must put it outside the quotes (and remove the space after it). Moreover, you must run the SQL before moving to the next record, otherwise you'll use the value of cartons from the next record.
    The RunSQL instruction should have UpdateCartons as argument, since that is the name of the variable, not "UpdateCartons".
    Your SQL statement will update every record in the Products table. Shouldn't it be only be the record for the current ProductID?

Posting Permissions

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