Update field in MS-Access based on conditions

  • Hi All,

    I have written this query to update a field of a table.

    Update Application as A, Details as D set A.[Group] = D.[Group]

    where D.Code = A.Code

    The group field in Details table values are from SQL and if the values are like '' (means blank cell) and NULL, then I need to update the Application Group field as N/A.

    Can anyone suggest me to sort this out

  • Some questions:

    1) Is this all in one table or are multiple tables involved?

    2) What version of Access are you using?

    You should be aware that "" is looking for an empty string, while NULL is something entirely different, and you need to test for both conditions. It appears that the SQL syntax you are using is T-SQL (SQL Server) oriented, while Access uses a somewhat different syntax for some kinds of operations. I would suggest you try using a SELECT query to get the exact set of records that you want to update using the Access query builder, and then change it to an Update query when you are sure you are working with the correct record set.

    Wendell
    Colorful Colorado
    You can't see the view if you don't climb the mountain!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply