Results 1 to 5 of 5
  1. #1
    jordanturner is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Location
    Burnley, England
    Posts
    32

    Please help SQL Syntax

    I know this is like 'driving off a cliff' as some people have stated, but I really need this to update the quantity in stock to 1.



    So here's the SQL

    UPDATE tblStock SET tblStock.QuantityInStock = 1
    WHERE (((tblStock.StockID)=[Forms]![frmDispatch].[frmDispatchLine].[StockID]));

    The problem is that when this query is run from the subtable on the form it constantly asks for the parameter value of "[Forms]![frmDispatch].[frmDispatchLine].[StockID]", so I was just wondering, anyone know how to solve this? Get rid of that annoying pop-up box and actually let it find the StockID from the subform.

    Thanks
    Jordan T

  2. #2
    maximus's Avatar
    maximus is offline Expert
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Aug 2009
    Location
    India
    Posts
    931
    Ur SQL will be like this:

    UPDATE tblStock SET tblStock.QuantityInStock = 1 WHERE tblStock.StockID=[Forms]![Your Form Name Here]![Control on the Form];

    An Example:

    I have a table Table1 a form Table1 I want to update the Member_Name to Antony for ID_Member=ID_Number on my form Table1
    UPDATE Table1 SET Table1.Member_Name = "Antony"
    WHERE [Table1].[ID_Number]=[Forms]![Table1]![ID_Number];

  3. #3
    jordanturner is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Location
    Burnley, England
    Posts
    32
    Hiya, thanks for the quick reply.
    But the only problem is that doesn't work either, is it because its taking the parameter value from a subform?

    Thanks,
    Jordan T

  4. #4
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    Please remember the form must be open.

  5. #5
    jordanturner is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Sep 2010
    Location
    Burnley, England
    Posts
    32
    UPDATE tblStock SET tblStock.QuantityInStock = 1
    WHERE [tblStock].[StockID]=Forms!frmPurchaseOrderBT!frmPurchaseOrderLine.For m.StockID;

    Solved it by using that, thanks for the help though.

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

Similar Threads

  1. What is the correct syntax for
    By giladweil in forum Access
    Replies: 1
    Last Post: 07-29-2010, 04:56 AM
  2. Syntax error
    By smikkelsen in forum Access
    Replies: 6
    Last Post: 04-28-2010, 09:38 AM
  3. Syntax Contains Problem
    By pimlicosnail in forum Forms
    Replies: 9
    Last Post: 02-18-2010, 12:16 PM
  4. Syntax Error
    By KLynch0803 in forum Programming
    Replies: 11
    Last Post: 02-04-2010, 01:45 AM
  5. if or syntax help needed
    By techexpressinc in forum Queries
    Replies: 16
    Last Post: 01-11-2010, 08:03 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