E
E. Kwong
I'm trying to extract the field names of a one-row table but keep gettning
"Error 91 : Object variable or With block variable not set". The code
snippet:
Dim rst As DAO.Recordset
Dim f As DAO.Field
On Error GoTo GetFieldNames_Err
Set rst = CurrentDb.OpenRecordset("table1")
For Each f In Rst.Fields
do somthing
Next
rst.Close
The error keeps hitting at the "set rst..." line. Really puzzling. I've
googled about the OpenRecordset method and have tried suggestions on some of
the posts but still to no avail.
I'm using Access 2003, and SQL Server 2000 tables. The codes are in a
Project (.adp). The References include DAO 3.6 object library and ADO 2.1
library.
Any insight greatly appreciated.
"Error 91 : Object variable or With block variable not set". The code
snippet:
Dim rst As DAO.Recordset
Dim f As DAO.Field
On Error GoTo GetFieldNames_Err
Set rst = CurrentDb.OpenRecordset("table1")
For Each f In Rst.Fields
do somthing
Next
rst.Close
The error keeps hitting at the "set rst..." line. Really puzzling. I've
googled about the OpenRecordset method and have tried suggestions on some of
the posts but still to no avail.
I'm using Access 2003, and SQL Server 2000 tables. The codes are in a
Project (.adp). The References include DAO 3.6 object library and ADO 2.1
library.
Any insight greatly appreciated.