Results 1 to 4 of 4
  1. #1
    gammaman is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    56

    update SQL not working

    I have two update SQL's. The first one is working and the second one is not. Can someone please help me figure out why?

    The good one
    Code:
    Set db2 = CurrentDb
    
    
    strSQL2 = "UPDATE tblJobFamily INNER JOIN tblActiveJCodes ON tblJobFamily.jobcode = tblActiveJCodes.jobcode " & _
               "SET tblJobFamily.JObFamily = tblActiveJCodes.JOB_FAMILY ," & _
                   "tblJobFamily.BaseHours = tblActiveJCodes.std_hours ," & _
                   "tblJobFamily.JobFunction = tblActiveJCodes.JOB_FUNCTION ," & _
                     "tblJobFamily.EEOC = tblActiveJCodes.XLATLONGNAME ," & _
                     "tblJobFamily.SalaryPlan = tblActiveJCodes.SAL_ADMIN_PLAN ," & _
                      "tblJobFamily.CompFreq = tblActiveJCodes.comp_frequency ," & _
                      "tblJobFamily.FLSA = tblActiveJCodes.flsa_status " & _
              "WHERE tblJobFamily.JobCode = '" & Me.JobCode & "'"
    
    
    db2.Execute strSQL2, dbFailOnError
    The bad one

    Code:
    Set db4 = CurrentDb
    
    
    strSQL4 = "UPDATE tblJobFamily INNER JOIN tblJobCdMapping ON  tblJobFamily.jobcode = tblJobCdMapping.JOBCODE " & _
              " AND tblJObcodeMapping.SETID = tblJobFamily.Setid " & _
               " SET tblJobFamily.Merit = tblJobCdMapping.[COMP_RATECD] " & _
              " WHERE tblJobFamily.JobCode = '" & Me.JobCode & "' " & _
              " AND tblJobCdMapping.[COMP_RATECD] = 'COMMON';"
    
    
    
    
    db4.Execute strSQL4, dbFailOnError


  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,550
    have you tried running it as a query?
    Queries will give error messages, and debugging is easier.

  3. #3
    gammaman is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    56
    As a pass-through query? I have not. i did however use the query builder and the query was successful.

  4. #4
    gammaman is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Mar 2013
    Posts
    56
    Never mind. I woodshed(ed) myself.

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

Similar Threads

  1. Update Query not working
    By Gerdien in forum Queries
    Replies: 12
    Last Post: 06-23-2017, 07:45 AM
  2. UPDATE query not working
    By BrockWade in forum Queries
    Replies: 5
    Last Post: 02-10-2014, 04:25 PM
  3. VBA on Update is not working
    By khodem in forum Forms
    Replies: 8
    Last Post: 01-27-2014, 12:53 PM
  4. Reports not working after MS Update
    By lauradilts in forum Access
    Replies: 4
    Last Post: 01-13-2012, 09:29 AM
  5. Update table not working
    By newtoAccess in forum Queries
    Replies: 1
    Last Post: 11-27-2010, 04:43 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