If MsgBox("Do you wish to delete this record?", vbYesNo, "Delete Confirmation") = vbYes Then
If MsgBox("Are you SURE you want to delete this record?" & vbCrLf & _
"This will permanently delete the record.", vbYesNo, "2nd Delete Confirmation") = vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
End If
End If
Hello Bob
I have very strange question about MsgBox
Is it possible that the text which is in MSG box ("Do you wish to delete this record?") use from table (If I create a table with warning and with alert messages)
Function DeleteARecord
If MsgBox("Do you wish to delete this record?", vbYesNo, "Delete Confirmation") = vbYes Then
If MsgBox("Are you SURE you want to delete this record?" & vbCrLf & _
"This will permanently delete the record.", vbYesNo, "2nd Delete Confirmation") = vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
End If
End If
End Function
Private Sub DeleteButton_Click()
DeleteARecord
End Sub
This will happen with a new record, i.e. a record that hasn't been saved yet. There are a few ways you could handle the UI, but I think this should work:I have tried this on my form but it always comes up with the message "The command or action 'DeleteRecord' isn't available now" - Any ideas?
Call Forms("ZooMobile Booking Form").DelClientCmd_Click
DoCmd.OpenForm "ZooMobile Booking Form", , , "[Client_ID] = " & Me.ClientIDTxt
DoCmd.Close acForm, "Booking Forms Client Search"
Forms("ZooMobile Booking Form").SetFocus
Call DelClientCmd_Click
DoCmd.OpenForm "ZooMobile Booking Form", , , "[Client_ID] = " & Me.ClientIDTxt
RunCommand acCmdSaveRecord
DoCmd.Close acForm, "Booking Forms Client Search"
Public Sub DelClientCmd_Click()
Private Sub DelClientCmd_Click()