办法已想到了
我重建了一个一样的表做为临时表用点打印在加个确定后把数据加入到打印模块后就自动删除临时表数据就行了
代码如下
Private Sub Command9_Click()
Set RS = New ADODB.Recordset '新建一个recordset
Set lsRS = New ADODB.Recordset
RS.CursorType = adOpenStatic
RS.CursorLocation = adUseClient
RS.LockType = adLockPessimistic
RS.Open "SELECT * FROM byq1 ", Con
RS.AddNew
With RS
.Fields("zzg1AB") = Text1(0).Text
.Fields("型号") = Text1(1).Text
.Fields("制造编号") = Text1(2).Text
.Fields("结线组别") = Text1(3).Text
.Fields("制造厂家") = Text1(4).Text
.Fields("额定电压G") = Text1(5).Text
.Fields("额定电压D") = Text1(6).Text
.Fields("容量") = Text1(7).Text
.Fields("冷却方式") = Text1(8).Text
.Fields("出厂日期") = Text1(9).Text
.Fields("zzg1AC") = Text1(10).Text
.Fields("zzg1BC") = Text1(11).Text
.Fields("1phl") = Text1(12).Text
.Fields("2phl") = Text1(13).Text
.Fields("3phl") = Text1(14).Text
.Fields("4phl") = Text1(15).Text
.Fields("5phl") = Text1(16).Text
.Fields("zzg2AB") = Text1(17).Text
.Fields("zzg2AC") = Text1(18).Text
.Fields("zzg2BC") = Text1(19).Text
.Fields("zzg3AB") = Text1(20).Text
.Fields("zzg3AC") = Text1(21).Text
.Fields("zzg3BC") = Text1(22).Text
.Fields("zzg4AB") = Text1(23).Text
.Fields("zzg4AC") = Text1(24).Text
.Fields("zzg4BC") = Text1(25).Text
.Fields("zzg5AB") = Text1(26).Text
.Fields("zzg5AC") = Text1(27).Text
.Fields("zzg5BC") = Text1(28).Text
.Fields("zzda0") = Text1(29).Text
.Fields("zzdb0") = Text1(30).Text
.Fields("zzdc0") = Text1(31).Text
.Fields("6phl") = Text1(32).Text
.Fields("gjl") = Text1(33).Text
.Fields("djl") = Text1(34).Text
.Fields("名称") = Text1(35).Text
.Fields("摇表") = Text1(36).Text
.Fields("耐压设备") = Text1(37).Text
.Fields("万用表") = Text1(38).Text
.Fields("直流电阻仪") = Text1(39).Text
.Fields("其它1") = Text1(40).Text
.Fields("其它2") = Text1(41).Text
.Fields("高压侧交流耐压") = Text1(42).Text
.Fields("耐压前绝缘G") = Text1(43).Text
.Fields("耐压后绝缘G") = Text1(44).Text
.Fields("低压侧交流耐压") = Text1(45).Text
.Fields("耐压前绝缘D") = Text1(46).Text
.Fields("耐压后绝缘D") = Text1(47).Text
.Fields("结论") = Text1(48).Text
.Fields("温度") = Text1(49).Text
.Fields("湿度") = Text1(50).Text
.Fields("试验人员") = Text1(51).Text
.Fields("试验日期") = Text1(52).Text
.Update
End With
now_add = Not now_add
MsgBox ("确定打印吗")
DataReport.DataMember = "Command2"
DataReport.Show
While Not RS.EOF()
RS.Delete
RS.MoveNext
Wend
End Sub
不知合理不请大老们指点。
[此贴子已经被作者于2022-4-28 10:43编辑过]