Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Location
    Walnut Cove, NC
    Posts
    101

    Unanswered: Error: SQL command not properly ended

    I have written code in Visual Basic and I have the following UPDATE statement:

    sSql = "UPDATE vn_inv a SET a.to_dp_id = b.dp_id," _
    & "a.to_sa_id = b.jn_acct_id, a.prob_type = b.prob_type," _
    & "a.tr_id = b.tr_id" _
    & "FROM wr b WHERE a.wr_id = b.wr_id"

    When I run the code in the form, I get the message "SQL command not properly ended". Where is the error of my syntax?

    Thanks,

    SBR

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Debug your string once, you might notice something about the spaces between your lines...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jan 2004
    Location
    Walnut Cove, NC
    Posts
    101
    I found the correct syntax for my SQL statement:

    Update vn_inv SET (vn_inv.to_dp_id, vn_inv.to_sa_id) = (SELECT wr.dp_id, wr.jn_acct_id FROM wr WHERE vn_inv.wr_id = wr.wr_id);

    SBR

Posting Permissions

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