public override bool ProcessWordByWord(OfficeDocumentProcessor aWordProcessor)
        {
            Document.MoveFirst(); // to avoid an error on the first 'Edit'
            int nDontCare = 0;    // don't care

            while (!Document.EOF)
            {
                Fields aFields = Document.Fields;
                Field  aField  = aFields[m_strFieldName];
                if (aField.Value != System.DBNull.Value)
                {
                    AccessRange aWordRange = new AccessRange(aField, this);

                    try
                    {
                        if (!aWordProcessor.Process(aWordRange, ref nDontCare))
                        {
                            return(false);
                        }
                    }
                    catch (Exception)
                    {
                        throw;
                    }
                    finally
                    {
                        // this gets called whether we successfully process the word or not,
                        //  whether we're returning 'false' (in the try) or not, and whether we
                        //  have an exception or not... just exactly what we want, or MSAccess
                        //  process won't release when we exit.
                        OfficeApp.ReleaseComObject(aField);
                        OfficeApp.ReleaseComObject(aFields);
                    }
                }

                Document.MoveNext();
            }

            return(true);
        }
        public DbFieldSelect(TableDefs aTableDefs)
        {
            InitializeComponent();

            for (int i = 0; i < aTableDefs.Count; i++)
            {
                TableDef aTable = aTableDefs[i];

                if (aTable.Attributes == 0)
                {
                    TreeNode node    = this.treeViewTablesFields.Nodes.Add(aTable.Name);
                    Fields   aFields = aTable.Fields;
                    for (int j = 0; j < aFields.Count; j++)
                    {
                        Field aField = aFields[j];
                        node.Nodes.Add(aField.Name);

                        OfficeApp.ReleaseComObject(aField); // needed or Access stays running after exit
                    }
                    OfficeApp.ReleaseComObject(aFields);
                }
                OfficeApp.ReleaseComObject(aTable);
            }
        }