+ Reply to Thread
Results 1 to 2 of 2

Can not run SQL update statement

  1. #1
    Registered User
    Join Date
    11-28-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    73

    Can not run SQL update statement

    Hello,

    I am very near finishing the script below. toward the bottom in a loop, i have "DoCmd.RunSQL SQL_String" but when it gets to this point, i get an error message stating, "Run-time error '2046': The command or action 'RunSQL' isn't available now."

    Any ideas? the only spot i see myself disconnecting from the database is the condition endnow statement, unless im missing something:

    Please Login or Register  to view this content.
    I have bolded the line where the error occurs.

  2. #2
    Registered User
    Join Date
    11-28-2012
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    73

    Re: Can not run SQL update statement

    Nevermind, got it working. Turns out, i was closing the connection at con.Close.

    Then, instead of DoCmd.RunSQL SQL_String , used con.Execute (SQL_String).

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA and SQL - help with update statement
    By jsabo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-21-2013, 06:57 PM
  2. Update cell formula with in Next - For statement
    By Palabalo in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-26-2013, 01:41 PM
  3. IIF statement in SQL Update query in VBA
    By mhm in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-14-2013, 08:23 PM
  4. Syntax Error in UPDATE Statement ?
    By AnthonyWB in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-02-2011, 11:06 AM
  5. VBA SQL update statement
    By shawby in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-29-2010, 08:41 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1