SQL to Excel [Paramater Query Syntax Issue]

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dekk
    New Member
    • Nov 2010
    • 11

    SQL to Excel [Paramater Query Syntax Issue]

    When running the full macro (not shown), it delivers an error that '=' incorrect syntax.

    The code is trying to extract data from SQL server into Excel

    Code:
          objMyCmd.CommandText = "SELECT BU, JobDesc FROM Budget27MI_map" _
             & "WHERE BU =" & Worksheets("Sheet1").Range("A1").Value
    Suggestions on syntax for parameter query to work?
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Try to put some spaces between your table name and the WHERE clause.

    Happy Coding!!!

    ~~ CK

    Comment

    Working...