G
Greg Soulsby
I would like to make use of the On Error statement but it
is being completly ignored. When there is an error the
error message pops up, no matter whether I use On Error
Goto Line, Goto 0 or Resume Next.
Here is the current version of the code
Dim MyDB As Database
Dim steps_list As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set table_audit = MyDB.OpenRecordset("audit_table",
dbOpenDynaset)
' Dim table_to_report As DAO.TableDef
' Set table_to_report = MyDB.OpenRecordset(table_name,
dbOpenDynaset)
Set table_to_report = MyDB.TableDefs(table_name)
With MyDB
number_records = table_to_report.RecordCount
With table_audit
.AddNew
![table_name] = table_name
![field_name] = "Table record count"
![count_non_null] = number_records
.Update
End With
' Dim myfield As DAO.Field
For Each fldloop In table_to_report.Fields
field_type = fldloop.Type
field_attribute = fldloop.Attributes
field_name = fldloop.Name
Set myfield = table_to_report.Fields(field_name)
On Error Resume Next
field_description = myfield.Properties
("Description")
Error message pops up when there is an error on the above
line
Thanks
is being completly ignored. When there is an error the
error message pops up, no matter whether I use On Error
Goto Line, Goto 0 or Resume Next.
Here is the current version of the code
Dim MyDB As Database
Dim steps_list As Recordset
Set MyDB = DBEngine.Workspaces(0).Databases(0)
Set table_audit = MyDB.OpenRecordset("audit_table",
dbOpenDynaset)
' Dim table_to_report As DAO.TableDef
' Set table_to_report = MyDB.OpenRecordset(table_name,
dbOpenDynaset)
Set table_to_report = MyDB.TableDefs(table_name)
With MyDB
number_records = table_to_report.RecordCount
With table_audit
.AddNew
![table_name] = table_name
![field_name] = "Table record count"
![count_non_null] = number_records
.Update
End With
' Dim myfield As DAO.Field
For Each fldloop In table_to_report.Fields
field_type = fldloop.Type
field_attribute = fldloop.Attributes
field_name = fldloop.Name
Set myfield = table_to_report.Fields(field_name)
On Error Resume Next
field_description = myfield.Properties
("Description")
Error message pops up when there is an error on the above
line
Thanks