Last active
August 10, 2021 12:34
-
-
Save eggist77/bc1d5d40c37a31b0ecfd0a3d8c96284d to your computer and use it in GitHub Desktop.
vba vba_access_vba.vb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'保存ボタン | |
Private Sub saveBtn_Click() | |
DoCmd.RunCommand acCmdSaveRecord | |
End Sub | |
'キャンセルボタン | |
Private Sub canselBtn_Click() | |
Me.Undo | |
End Sub | |
'終了ボタン | |
Private Sub closeBtn_Click() | |
If Me.Dirty Then | |
If MsgBox("データが更新されてます。保存して終了しますか。", vbOKCancel) = vbCancel Then | |
Exit Sub | |
Else | |
saveBtn_Click() | |
End If | |
End If | |
DoCmd.Close | |
End Sub | |
' 更新前確認 | |
Private Sub Form_BeforeUpdate(Cancel As Integer) | |
res = MsgBox("データを更新しますか", vbYesNo) | |
If res = vbNo Then | |
Cancel = True | |
Me.Undo | |
End If | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment