Results 1 to 3 of 3

Thread: SQL ? (A2K)

  1. #1
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: SQL ? (A2K)

    You seem to have "INTO refCMC_SBAD_ADDR3" all over the place! It should only be there once, after "INSERT INTO". Remove all the other occurrances.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  2. #2
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    SQL ? (A2K)

    Extremely long lines split by HansV

    I'm hoping someone can show me my code error:

    <pre>Dim dbs As Database
    Dim rst As Recordset
    Dim mySQL As String

    Dim ind As String

    Set dbs = CurrentDb
    Set rst = dbs.OpenRecordset("dbo_CMC_SBAD_ADDR")
    With rst
    .MoveFirst
    Do Until .EOF = True
    If IsNull("SBSB_CK") = False Then
    mySQL = "INSERT INTO refCMC_SBAD_ADDR3 " & _
    "(SBSB_CK, SBAD_TYPE, SBAD_ADDR1, SBAD_ADDR2,SBAD_CITY, SBAD_STATE, _
    SBAD_ZIP,SBAD_PHONE) " & _
    "INTO refCMC_SBAD_ADDR3 " & _
    "VALUES ('" & !SBSB_CK & "','" & !SBAD_TYPE & "','" & !SBAD_ADDR1 & "','" & !SBAD_ADDR2 & "," & _
    !SBAD_CITY & "','" & !SBAD_STATE & "','" & !SBAD_ZIP & "','" & !SBAD_PHONE & "') " & _
    "INTO refCMC_SBAD_ADDR3"
    Debug.Print mySQL
    DoCmd.RunSQL mySQL
    Debug.Print
    End If
    .MoveNext
    Loop
    End With
    rst.Close
    MsgBox "Process Complete"
    End Sub
    </pre>

    I get "Run Time Error 3134"--"Syntax Error in INSERT INTO statement" with the BOLDED (above) highlighted.

    Thanks,
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  3. #3
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: SQL ? (A2K)

    Do what Mark says. you also have a problem in the line:

    "VALUES ('" & !SBSB_CK & "','" & !SBAD_TYPE & "','" & !SBAD_ADDR1 & "','" & !SBAD_ADDR2 & "," & _

    The "," at the end of the line should be replaced with "','" to become:

    "VALUES ('" & !SBSB_CK & "','" & !SBAD_TYPE & "','" & !SBAD_ADDR1 & "','" & !SBAD_ADDR2 & "','" & _

Posting Permissions

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