+ Reply to Thread
Results 1 to 2 of 2

VBA Code to Push data from Sheet to SQL database

  1. #1
    Registered User
    Join Date
    10-09-2017
    Location
    Stavanger, Norway
    MS-Off Ver
    O365
    Posts
    78

    VBA Code to Push data from Sheet to SQL database

    I have code to send data to a SQL Database
    The data has 21 columns
    The code loops through each row.

    When I debug the code I get an error message saying that there is syntax error in the routine "connection.Execute" in line 47
    "Incorrect syntax near keyword 'User'."

    I can't for the life of me workout what is wrong. Can Anyone help.. the code is below
    Please Login or Register  to view this content.

  2. #2
    Forum Contributor Gregor y's Avatar
    Join Date
    10-24-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2010 32-Bit
    Posts
    280

    Re: VBA Code to Push data from Sheet to SQL database

    The sql server is telling you that it doesn't like the bare field name 'User' because that word is reserved for other uses. Maybe try adding double quotes?

    Please Login or Register  to view this content.
    If it'd make you feel better using my answer because of my street cred, then you can go ahead and click Add Reputation below to improve it.

+ 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. Replies: 17
    Last Post: 08-03-2020, 05:00 AM
  2. Userform Code Required to Control Data between Database and Input Sheet
    By Rudidw in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-28-2020, 01:15 AM
  3. Replies: 1
    Last Post: 10-05-2017, 04:43 PM
  4. [SOLVED] Enter new data every day in one column, and push the data to the corresponding sheet
    By lisal in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-12-2013, 09:40 AM
  5. [SOLVED] Push Data from one sheet to another using Date and product ID.
    By Aussie1 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 05-28-2013, 04:32 PM
  6. UDF in excel to use a dropdown list in a sheet, to push data to other sheet.
    By elnicko in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-17-2011, 08:13 PM

Tags for this Thread

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