L
Lito
I am new to Access and SQL. I am trying to open a recordset, initially
showing all records but eventually I will also need to apply filters in a
WHERE clause.
I am getting a "Syntax error in FROM clause" message, and can't figure out
what I am doing wrong. I'd appreciate very much any comments. Below is the
code:
Dim CurConn As New ADODB.Connection
Dim C As New ADODB.Recordset
Dim CurDB As Object
Dim sql As String
sql = "SELECT * FROM TableName"
Set CurDB = CurrentDb
Set CurConn = New ADODB.Connection
With CurConn
.Provider = "Microsoft.jet.OLEDB.4.0"
.ConnectionString = "data source= " & CurDB.NAME
.Open
End With
Set C = New ADODB.Recordset
C.CursorType = adOpenDynamic
C.LockType = adLockOptimistic
C.Open sql, CurConn, , , adCmdTable
BTW, I am using Access 2000.
Thanks!
showing all records but eventually I will also need to apply filters in a
WHERE clause.
I am getting a "Syntax error in FROM clause" message, and can't figure out
what I am doing wrong. I'd appreciate very much any comments. Below is the
code:
Dim CurConn As New ADODB.Connection
Dim C As New ADODB.Recordset
Dim CurDB As Object
Dim sql As String
sql = "SELECT * FROM TableName"
Set CurDB = CurrentDb
Set CurConn = New ADODB.Connection
With CurConn
.Provider = "Microsoft.jet.OLEDB.4.0"
.ConnectionString = "data source= " & CurDB.NAME
.Open
End With
Set C = New ADODB.Recordset
C.CursorType = adOpenDynamic
C.LockType = adLockOptimistic
C.Open sql, CurConn, , , adCmdTable
BTW, I am using Access 2000.
Thanks!