Results 1 to 2 of 2
  1. #1
    dollygg is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jul 2009
    Posts
    73

    update query

    Why the following code written in VB6 didn't work:



    Set rst = New ADODB.Recordset
    '
    With rst
    On Error Resume Next
    .Open "UPDATE Collateral, [Custodian Collateral 3rd PartySumBySM] SET [Collateral].[SetType] = [Custodian Collateral 3rd PartySumBySM].[SetType] WHERE " & _
    "((Collateral.TUnits = [Custodian Collateral 3rd PartySumBySM].[Collateral Units]) AND (Collateral.Fund = [Custodian Collateral 3rd PartySumBySM].[Fund]) AND (Collateral.SM = [Custodian Collateral 3rd PartySumBySM].[SM]))", sDBcn, 3, 3
    On Error GoTo 0
    End With
    Set rst = Nothing

    Please note that [Custodian Collateral 3rd PartySumBySM] is an query result from another query, Collateral is a table. The backend is an MS Access Database(mdb file)

  2. #2
    Fre is offline Novice
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    13
    You need to join before setting

    UPDATE Collateral INNER JOIN [Custodian Collateral 3rd PartySumBySM] ON Collateral.TUnits = [Custodian Collateral 3rd PartySumBySM].[Collateral Units] AND Collateral.Fund = [Custodian Collateral 3rd PartySumBySM].[Fund] AND Collateral.SM = [Custodian Collateral 3rd PartySumBySM].[SM]
    SET [Collateral].[SetType] = [Custodian Collateral 3rd PartySumBySM].[SetType]

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

Similar Threads

  1. Update query help
    By techexpressinc in forum Queries
    Replies: 4
    Last Post: 03-31-2010, 07:13 AM
  2. Update Query
    By vvasudev in forum Queries
    Replies: 0
    Last Post: 11-10-2009, 01:32 AM
  3. Update Query- selective update?
    By stephenaa5 in forum Queries
    Replies: 1
    Last Post: 10-29-2009, 11:15 AM
  4. Update Query
    By GrnISSO in forum Queries
    Replies: 0
    Last Post: 06-15-2007, 05:41 PM
  5. Need help with an Update query ...
    By valkyry in forum Queries
    Replies: 0
    Last Post: 04-23-2007, 08:45 PM

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