|
本帖最后由 紫风 于 2011-8-22 09:19 编辑
用未绑定窗体不就好了?你不点保存就不保存……
个人习惯:主窗体用未绑定窗体,子窗体用临时表窗体。保存时主、子记录一起保存,退出时清空子临时表。
给楼主个例子:
Private Sub cmd保存_Click()
If MsgBox("您确认要保存记录吗?", vbQuestion + vbYesNo, SoftName) = vbYes Then
Me.Refresh
Dim rst As New ADODB.Recordset
Dim Stemp As String
rst.Open "tbl现金账单", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
With rst
.AddNew
![账单号码] = Me.账单号码
![日期] = Me.日期
![客户名称] = Me.客户名称
.Update
End With
rst.Close
Set rst = Nothing
DoCmd.SetWarnings False
DoCmd.RunSQL "insert into tbl现金账单明细 SELECT tbl现金账单明细temp.* FROM tbl现金账单明细temp;"
DoCmd.SetWarnings True
End Sub |
|