代码改成
If e.OldRange.ColSel <> e.NewRange.ColSel AndAlso Forms("窗口2").Opened Dim txt As WinForm.TextBox = Forms("窗口2").Controls("TextBox1") txt.BindingField = Nothing txt.BindingField = e.Table.Name & "." & e.Table.Cols(e.NewRange.ColSel).NameEnd If