Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Mt. Olive, North Carolina, USA
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Updating Table with SQL (2000)

    Hi all,
    I am trying to update a table from a temporary table but I am getting a window that comes up asking for the parameter value of tblTemp.SumofQuantity.
    Here is the code:
    Dim stSQL As String
    strSQL = "select tblICard.jn, sum(tblICard.Quantity) as SumofQuantity into tblTemp from tblIcard " & "where tblICard.Location =" & Chr(34) & "b" & Chr(34) & "group by tblICard.jn"
    DoCmd.RunSQL strSQL
    strSQL = "update tblInventoryTest set tblinventorytest.quan = tblTemp.SumofQuantity where tblInventorytest.jn = tblTemp.jn "
    DoCmd.RunSQL strSQL
    Where did I go wrong?
    Thanks in advance.

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Updating Table with SQL (2000)

    You haven't actually included tblTemp in the update query. Try this:

    strSQL = "UPDATE tblInventoryTest INNER JOIN tblTemp ON tblInventoryTest.jn = tblTemp.jn SET tblInventoryTest.quan = tblTemp.SumofQuantity"

  3. #3
    2 Star Lounger
    Join Date
    Nov 2002
    Location
    Mt. Olive, North Carolina, USA
    Posts
    170
    Thanks
    8
    Thanked 0 Times in 0 Posts

    Re: Updating Table with SQL (2000)

    PERFECT!! Thank you.

Posting Permissions

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