Results 1 to 2 of 2
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    IS this code correct?

    HI



    been going round in circles here

    Have a table with an auto number key called tblmemorial and the key field is MemorialID

    HAve another table called tbljoin which has a field called fkMemorialID

    Both tables have two identical fields GraveNo and Plot

    So I want to copy the field Memorial ID to the field fkMemorialID so usingthe query wizard created

    Code:
    UPDATE tblMemorial INNER JOIN tblJoin ON tblMemorial.MemorialID = tblJoin.fkMemorialId SET tblJoin.fkMemorialId = [tblMemorial].[MemorialID]
    WHERE (("where [tblMemorial].[Plot]"=[tblJoin].[Plot] And [tblMemorial].[GraveNo]=[tblJoin].[GraveNo]));
    When I run it I get the message you are about to update 0 rows can someone please advise?

    thanks

    Ian

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    having joined

    ON tblMemorial.MemorialID = tblJoin.fkMemorialId

    you can't then change the values

    SET tblJoin.fkMemorialId = [tblMemorial].[MemorialID]

    And I've never seen a sql construct like this

    WHERE (("where [tblMemorial].[Plot]"=[tblJoin].[Plot] And [tblMemorial].[GraveNo]=[tblJoin].[GraveNo]));

    try this instead

    UPDATE tblMemorial INNER JOIN tblJoin ON tblMemorial.Plot=tblJoin.Plot And tblMemorial.GraveNo=tblJoin.GraveNo SET tblJoin.fkMemorialId = tblMemorial.MemorialID

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

Similar Threads

  1. Replies: 5
    Last Post: 10-13-2015, 02:53 PM
  2. Replies: 5
    Last Post: 09-12-2014, 06:41 AM
  3. code to determine correct dimensions
    By mbar in forum Programming
    Replies: 3
    Last Post: 05-03-2012, 04:27 PM
  4. Replies: 9
    Last Post: 06-26-2011, 09:14 PM
  5. Correct code for challenging dates?
    By thekruser in forum Queries
    Replies: 6
    Last Post: 11-08-2010, 03:38 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