ADO recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am opening a ADO recordset based on a SQL statement. I have no problems
until I add one particular field. The field is a text field, based on a
table in the existing query. It is "tblAccounts.Section". I dont belive
there are limitations in terms of number of fields in an ado recodset, so I
cant understand why the open method fails when i add this field. The field
in its respective table is based on a lookup to another table, but
"tblAccounts.AcctResp" is also. Any suggestions? Thanks in advance

Do Until rsResp.EOF

intResp2 = rsResp.Fields(0).Value

strDataSQL = "SELECT tblAccounts.Account, tblAccounts.AcctDescr, " _
& "tblAccounts.AcctResp, " _
& "tblGLData.Period1, tblGLData.Period2,
tblGLData.Period3, " _
& "tblGLData.Period4, tblAccounts.Section " _
& "FROM tblAccounts INNER JOIN tblGLData ON " _
& "tblAccounts.Account = tblGLData.Account " _
& "WHERE (((tblAccounts.AcctResp) =" & intResp2 &
")) " _
& "ORDER BY tblAccounts.Account;"

'Open recordset
rsData.Open strDataSQL, cnn1, adOpenKeyset
 
"Section" is a reserved word in both Access and Jet. Try changing the name
of the column and see if that works.
 
Thanks Scott. That was my problem

Scott McDaniel said:
"Section" is a reserved word in both Access and Jet. Try changing the name
of the column and see if that works.
 
Back
Top