加上代码,如
For Each f As object In forms If f.opened Then If f.tablename = MainTable.name Then f.close End If End IfNext