Hi, everyone
Right now I need help on sql string.In Access I have a "table1" which has fields named "type"(data type:text),"section"(data type:text) etc
I have some coding:
Dim cnn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim r As Integer
Set cnn = CurrentProject.Connection
SQL = "select * from table1 where Section='c5'"
rst.Open SQL, cnn, adOpenStatic, adLockReadOnly
r = rst.RecordCount
rst.Close
Set rst = Nothing
every time I run these code I got run time error:method"open" of object"recordset" failed
but if i use another field's name in where clause(where type='A') everything is ok,or if I rename the field name "section" by other name in table, the sql string works well. I just can not use "section" in my SQL string.is it reserved? Thanks for any clues!!
rgao
Right now I need help on sql string.In Access I have a "table1" which has fields named "type"(data type:text),"section"(data type:text) etc
I have some coding:
Dim cnn As ADODB.Connection
Dim rst As New ADODB.Recordset
Dim r As Integer
Set cnn = CurrentProject.Connection
SQL = "select * from table1 where Section='c5'"
rst.Open SQL, cnn, adOpenStatic, adLockReadOnly
r = rst.RecordCount
rst.Close
Set rst = Nothing
every time I run these code I got run time error:method"open" of object"recordset" failed
but if i use another field's name in where clause(where type='A') everything is ok,or if I rename the field name "section" by other name in table, the sql string works well. I just can not use "section" in my SQL string.is it reserved? Thanks for any clues!!
rgao