Results 1 to 6 of 6
  1. #1
    Stefan Moser is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Location
    Bavaria / Germany
    Posts
    18

    Error in CurrentDb.Execute

    Dear all

    I've a problem with the following code ...
    Does anybody see the mistake I Did ?

    CurrentDb.Execute ("INSERT INTO tab_Print_Rep (ID_Konsi_Eingang,DruckZusatz) VALUES (" & Me.ID & "," & CStr(n) & " von:" & ")")

    Thanks for your help

  2. #2
    CJ_London is online now VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,399
    this bit - you are missing single quotes

    "," & CStr(n) & " von:" & ")"

    don't know what Cstr(n) is (I presume n is a value assigned somewhere)

    try

    ",'" & CStr(n) & " von:" & "')")

  3. #3
    Stefan Moser is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Location
    Bavaria / Germany
    Posts
    18
    Solved .. Thanks !!
    ( Name missmatch )

  4. #4
    Stefan Moser is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Location
    Bavaria / Germany
    Posts
    18
    Perfect thanks !!

  5. #5
    Stefan Moser is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Jun 2014
    Location
    Bavaria / Germany
    Posts
    18
    First I missmatched my tab's
    But the '" & CStr(n) & " von:" & "')") did solve the problem
    that was quick !
    Thanks again !!

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    CurrentDb.Execute does NOT require brackets.
    I recommend you use the dbFailOnError parameter with CurrentDb.Execute

    See this for more info

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

Similar Threads

  1. Replies: 2
    Last Post: 03-30-2015, 10:06 AM
  2. vba code help - Currentdb.execute
    By joycesolomon in forum Programming
    Replies: 5
    Last Post: 08-11-2014, 11:25 AM
  3. Replies: 12
    Last Post: 01-24-2014, 02:18 PM
  4. Problems with CurrentDb.Execute "UPDATE
    By GraeagleBill in forum Programming
    Replies: 4
    Last Post: 04-06-2013, 03:21 PM
  5. Update sql using currentdb.execute
    By laavista in forum Access
    Replies: 13
    Last Post: 08-15-2011, 03:51 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