On Error statement being ignored

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
 
G

George Nicholson

In the VBE: Tools>Options>General:
Make sure "Break on unhandled errors" is checked or error handlers can get
ignored.
 
G

Guest

Thanks George. Afer an hour of searching I did not come accross this in the docuemetation. You saved me hours of frustration.

Greg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top