Results 1 to 6 of 6
  1. #1
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Can't Figure an Update Query Out (2003)

    I need a query that should allow me to fill the empty cells in the Cdc column of the Mag table, based on the value in the Detail column of the same table since they both draw their values from the Centri table which is joined to the Mag table.
    Attached Files Attached Files

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

    Re: Can't Figure an Update Query Out (2003)

    You have to join the tables in the query on Detail vs CentroID. Try this:

    UPDATE Mag INNER JOIN Centri ON Mag.Detail = Centri.CentroID SET Mag.Cdc = [Centri].[CentroID]
    WHERE Mag.Cdc Is Null AND Centri.Codice Is Not Null

    By the way, there is no need to have both Detail and Cdc in the Mag table.

  3. #3
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't Figure an Update Query Out (2003)

    Thank you Hans, works perfectly.
    On another note...if I remove either fields from the Mag table, then the mdb frontend(attached to the next message) throws an error.
    Attached Files Attached Files

  4. #4
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't Figure an Update Query Out (2003)

    Here's the frontend <img src=/S/smile.gif border=0 alt=smile width=15 height=15>
    Attached Files Attached Files

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

    Re: Can't Figure an Update Query Out (2003)

    You'll have to modify the Query1 query to add the missing field. In fact, both Detail and Cdc are the same but they have a different lookup - both are linked to the CentroID field, but one displays the Codice field and the other the Nome field from the Centri table.

  6. #6
    Bronze Lounger
    Join Date
    Jan 2001
    Location
    Alzano Lombardo, Italy
    Posts
    1,483
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Can't Figure an Update Query Out (2003)

    Thanks for pointing that out Hans. It helped me realise I could delete the Detail field even without modifying the Query1 query.
    Attached Files Attached Files

Posting Permissions

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