Thread: ADODB SQL help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Eric Eric is offline
external usenet poster
 
Posts: 1,670
Default ADODB SQL help

Can anyone here tell me what is wrong with my SQL statement? I get a error of
Expected 1.

Sub UpdateData2()
On Error GoTo ErrorHandler

Dim MyCn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strSQL As String

Set MyCn = New ADODB.Connection

' Replace actual Access file path here
MyCn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" _
& "DBQ=G:\TestCQA.mdb"

Set rst = New ADODB.Recordset

strSQL = "SELECT * FROM tblExcel" _
& " WHERE tblExcel.TestID = " & Range("A2").Value

rst.Open strSQL, MyCn

If rst!IsReviewed = False Then 'no edit statement here?
rst!IsReviewed = True
rst.Update
End If

MyCn.Close

ErrorHandler_Exit:
Set MyCn = Nothing
Exit Sub

ErrorHandler:
MsgBox Err.Description
GoTo ErrorHandler_Exit

End Sub