可以参考一下:
更新数据时保存提示操作员
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strMsg As String
strMsg = "Data has changed."
strMsg = strMsg & "@Do you wish to save the changes?"
strMsg = strMsg & "@Click Yes to Save or No to Discard changes."
If MsgBox(strMsg, vbQuestion + vbYesNo, "Save Record?") = vbYes Then
'do nothing
Else
DoCmd.RunCommand acCmdUndo
'For Access 95, use DoMenuItem instead
'DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
End Sub
‘子窗口无数据时,隐藏
'*********** Code Start **********
Private Sub Form_Current()
With Me![SubformName].Form
.Visible = (.RecordsetClone.RecordCount > 0)
End With
End Sub
[此贴子已经被作者于2003-7-17 17:18:42编辑过]
|