Results 1 to 5 of 5
  1. #1
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    355
    Thanks
    3
    Thanked 0 Times in 0 Posts

    Left function problem in Access 2013

    Having just updated to 2013 I am seeing the expected errors with macros in Excel needing declaration including the PtrSafe but in Access I am seeing a problem wherever the Left() type function has been included. (also the Right and Mid)
    The error message says:
    There was an error compiling this function
    the Visual Basic module contains a syntax error.
    check the code, then recompile it
    OK


    when I remove the Left/Right/Mid function then it works fine.

    any suggestions would be most appreciated.
    thanks
    Alan

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts
    check references to see if any are missing.

  3. #3
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,203
    Thanks
    49
    Thanked 989 Times in 919 Posts
    Can you post some of your code with the offending functions?

    cheers, Paul

  4. The Following User Says Thank You to Paul T For This Useful Post:

    ase001 (2015-01-05)

  5. #4
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    355
    Thanks
    3
    Thanked 0 Times in 0 Posts
    The code is actually in the query field in this particular instance and is:
    "Left([sort_code],2) & Mid([sort_code],4,2) & Right([sort_code],2) AS S_C,"

    all pretty basic run of the mill, but the left/right/mid causes the compile error

  6. #5
    3 Star Lounger
    Join Date
    Apr 2001
    Location
    Warrington, Cheshire
    Posts
    355
    Thanks
    3
    Thanked 0 Times in 0 Posts
    The LEFT function is a red herring!
    I have a module in the database that declares a function completely unrelated to the Left/Right/Mid and I had overlooked it when including PtrSafe in the 'Declare Function' script.

    As soon as I changed it to 'Declare PtrSafe Function' then the code and queries run fine once more.

    thanks PATT, appreciate the quick jump in on this.
    Sounds like I gotta bit of catching up to do with other macros and databases now.

Posting Permissions

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