If Tables("资金总账").DataTable.HasChanges Then
MessageBox.Show("当前数据已修改,请保存后新增!","提示!")
Return
Else
Tables("资金总账").AllowEdit =True
If DataTables("资金总账").DataRows.Count = 0 Then '如果是一个空表
Return '那么返回
End If
Dim ColNames As String() = {"凭证号"} '定义一个数组,保存复制列的名称
Dim dr As DataRow = DataTables("资金总账").DataRows(DataTables("资金总账").DataRows.Count - 1) '获得最后一行
Dim dx As Row = Tables("资金总账").AddNew
For Each ColName As String In ColNames
dx(ColName) = dr(ColName) '将最后一行的内容复制到新增行中.
Next
End If
理由:
http://www.foxtable.com/help/topics/0560.htm