同一个数据库DB1.MDB下有两个数据表(注销员工详细资料、员工详细资料),表的结构是一样的,我想在datagrid(显示的是员工详细资料表)中选中一条记录后,通过一个Comman按钮将该条记录移动到注销员工详细资料表中。不知道怎么写。Private Sub Command2_Click()
If MsgBox("确认要导出到注销员工数据库吗?", vbInformation + vbYesNo, App.Title) = vbYes Then
If adoCallLink.EOF = True Then Exit Sub
With adoTempLink
If .EOF = False Then
.insert into 注销员工详细资料 select * from 员工详细资料 where 编号=编号
.MoveNext
adoCallLink.Requery
MsgBox "导出成功!", vbInformation, App.Title
Else
MsgBox "发生错误,在数据库中未找该编号的人员!", vbInformation + vbYesNo, App.Title
End If
End With
End Sub
If MsgBox("确认要导出到注销员工数据库吗?", vbInformation + vbYesNo, App.Title) = vbYes Then
If adoCallLink.EOF = True Then Exit Sub
With adoTempLink
If .EOF = False Then
.insert into 注销员工详细资料 select * from 员工详细资料 where 编号=编号
.MoveNext
adoCallLink.Requery
MsgBox "导出成功!", vbInformation, App.Title
Else
MsgBox "发生错误,在数据库中未找该编号的人员!", vbInformation + vbYesNo, App.Title
End If
End With
End Sub
你这样做2个表有什么意义呢?注销资料就是员工资料的标志不同而已
你可以加一个标志字段来看是不是已经注销了。
如果是要注销,只要把标志位改变就可以了啊