Results 1 to 4 of 4
  1. #1
    Rameez is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2009
    Location
    Chennai, India
    Posts
    40

    docmd.runsql not working

    I regularly use sql statements to update my tables.

    I found that docmd.runsql is not working when I put in names with ' in them.



    For example
    docmd.runsql "UPDATE Director SET Dir_Nme= '" & me.director & "' WHERE Empid=1000;"
    fails when the director textbox on my form has a name like O' Malley, Sardina....and passes if it is O Malley, Sardina

    !!!!!!!!!!! prob with '...i suppose

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That is because you are using the single quote as a string delimiter. Using the double quote as the delimiter has fewer problems.
    "UPDATE Director SET Dir_Nme = """ & me.director & """ WHERE Empid=1000;"

  3. #3
    Rameez is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    Jun 2009
    Location
    Chennai, India
    Posts
    40

    Smile

    This seems to work but not in all cases...

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    What case does *not* work correctly?

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

Similar Threads

  1. Replies: 7
    Last Post: 12-10-2018, 05:24 PM
  2. Replies: 5
    Last Post: 03-30-2010, 12:53 PM
  3. Issues with DoCmd.GoToControl
    By RaMcHiP in forum Programming
    Replies: 1
    Last Post: 05-09-2009, 08:56 PM
  4. DoCmd.OpenForm Modification
    By alsoto in forum Forms
    Replies: 6
    Last Post: 05-01-2009, 07:28 AM
  5. DoCmd.SendObject Help
    By bgreer5050 in forum Programming
    Replies: 0
    Last Post: 01-12-2007, 06:27 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