Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Unanswered: SQL & Code Error

    Here is the VBA query VERSION:
    Code:
    strSQL = "UPDATE [tblCARETSData] INNER JOIN [TblCARETSOfcRostersAPR10] ON [tblCARETSData].[ListAgentOfficeKey] = [TblCARETSOfcRostersAPR10].[OfficeKey] Set [tblCARETSData].[ListOfficeName] = [tblCARETSOfcRostersAPR10].[Officename]"
    CurrentDb.Execute strSQL
    strSQL = "UPDATE [tblCARETSData] INNER JOIN [TblCARETSOfcRostersAPR10] ON [tblCARETSData].[SaleAgentOfficeKey] = [TblCARETSOfcRostersAPR10].[OfficeKey] Set [tblCARETSData].[SaleOfficeName] = [tblCARETSOfcRostersAPR10].[Officename]"
    CurrentDb.Execute strSQL
    MsgBox "FINISHED ALL NORMALIZATION"
    It used to run fine but recently, for reasons I'm not clear of of I get the following error:

    Invalid SQL statement: expected "DELETE," "INSERT," "PROCEDURE," "SELECT," or "UPDATE"

    Update is in the query?

    When I run it in an SQL window I get the following:

    ERROR: "Type mismatch in expression"

    This is beyond me.

    Thanks . . . Rick
    Last edited by Rick Schreiber; 08-02-14 at 18:17. Reason: I think I have my errors backwards. Yikes!

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Type mismatch means the sql engine is expecting one daratype and ypu are providing a different datatype. Or ut coil be you are not delimiting literal values

    if it used to work and now it doesnt then
    either you have a corruption in the access file
    or
    its something you have changed
    I'd rather be riding on the Tiger 800 or the Norton

  3. #3
    Join Date
    Mar 2004
    Location
    California
    Posts
    502

    Data Type was CORRECT!

    Old data type was number - new data type is text.

    Once changed it worked flawlessly.

    I learned something this time.

    Thanks much!

    Rick

Posting Permissions

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