Share via

Getting syntax error in VBA Statement

Anonymous
2012-04-16T21:33:02+00:00

Private Sub CommandButton2_Click()

    x = 2

    y = 2

    Dim SQL As String

    Dim oConn As ADODB.Connection

    Dim rst As ADODB.Recordset

    Set oConn = New ADODB.Connection

    Set rst = New ADODB.Recordset

    oConn.Open STRDM

    Do While Cells(x, 1).Value <> ""

        strID = Cells(x, 1).Value

        SQL = "select tbl_idmFeed_a.*, tbl_rptUserToComputer2.* from tbl_idmFeed_A where tbl_idmFeed_a.WorkerID = '" & strID & "'" & " LEFT JOIN tbl_rptUserToComputer2 ON tbl_idmFeed_a.UserID = tbl_rptUserToComputer2.UserID"

        rst.Open SQL, oConn

Getting message incorrect syntax near the keyword LEFT

Any assistance is much appreciated.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments