Results 1 to 2 of 2
  1. #1
    Ragupathy is offline Novice
    Windows 10 Access 2016
    Join Date
    Oct 2016
    Posts
    1

    Need help

    Hi ,

    I am new to MS access . I got a query and not able to understand some part of it. below is the query. can some one help.

    UPDATE [table 1] INNER JOIN table2 ON [table 1].[filed1#] = table2.[filed1] SET [table1
    ].[filed2] = [table2]![filed2],
    [table1].[filed3] = [table2]![filed3
    ], [table1].[filed4] = [table2]![field4]
    WHERE ((([table1].[field2]) Is Null Or ([table1].[field2
    ])<[table1]![field2]) AND (([table1
    ].[field3]) Is Null Or ([table1].[filed3
    ])>[table1]![field3]) AND (([table1].[field4]) Is
    Null Or ([table1].[filed4])>[table1]![field4]));


    the part i did not understand is


    WHERE ((([table1].[field2]) Is Null Or ([table1].[field2
    ])<[table1]![field2])




    it is comparing same filed from same table . Only diff i see is "." and "!" what does it mean?


    WHERE ((([table1].[field2]) Is Null Or ([table1].[field2
    ])<[table1]![field2])

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Only diff i see is "." and "!" what does it mean?
    See
    http://stackoverflow.com/questions/2...access#2926286
    http://bytecomb.com/the-bang-exclama...erator-in-vba/


    the part i did not understand is
    I don't understand this query either.
    Here is what i see:
    this is an update query
    Code:
    UPDATE [table 1] INNER JOIN table2 ON [table 1].[filed1#] = table2.[filed1] '<< this line describes linking the tables
    
    SET [table1].[filed2] = [table2]![filed2],        '<< this set which fields get updated by which values
        [table1].[filed3] = [table2]![filed3], 
        [table1].[filed4] = [table2]![field4]
        
    WHERE ((([table1].[field2]) Is Null Or ([table1].[field2])<[table1]![field2])    ' this is the criteria that has to be met.
       AND (([table1].[field3]) Is Null Or ([table1].[filed3])>[table1]![field3]) 
       AND (([table1].[field4]) Is Null Or ([table1].[filed4])>[table1]![field4]));
    However,
    there are a lot of misspelled field names
    there is a hash mark that shouldn't be there
    the criteria in the WHERE clause is questionable.



    This is how I would change the SQL:
    Code:
    UPDATE [table 1] INNER JOIN table2 ON [table 1].[field1] = table2.[field1] 
    
    SET [table1].[field2] = [table2]![field2],
        [table1].[field3] = [table2]![field3], 
        [table1].[field4] = [table2]![field4]
        
    WHERE ((([table1].[field2]) Is Null Or ([table1].[field2])<[table2]![field2]) 
       AND (([table1].[field3]) Is Null Or ([table1].[field3])>[table2]![field3]) 
       AND (([table1].[field4]) Is Null Or ([table1].[field4])>[table2]![field4]));
    Removed the "#" in the UPDATE line. (a field name should NOT have a hash as part of the name)
    Corrected all of the misspelled field names.
    Changed "Table1" to "Table2" in the criteria.


    Don't know if the query will execute or provide valid results, but it can't be any worse.

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

Tags for this Thread

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