Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cancel update when adding a new record on form

Status
Not open for further replies.

cmmrfrds

Programmer
Feb 13, 2000
4,690
US
How do I cancel the adding of a new record? Under certain conditions, which I will detect in the beforeUpdate event, I want to display a message and cancel the update that is in progress. I tried making a recordset clone and then using the CancelUpdate method but it  said I needed an edit or addnew first. In order for this to work I would need to know the record is in update mode. It seems like there should be a simpler way.
 
you can use the follwing method...<br><br>Private Sub Form_BeforeUpdate(Cancel As Integer)<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;If (your condition = true) Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MsgBox &quot;your msg&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Cancel = True<br>&nbsp;&nbsp;&nbsp;&nbsp;End If<br><br>End Sub<br><br>i hope this would help you, ......<br> <p>Mohamed Aly<br><a href=mailto:samara_79@hotmail.com>samara_79@hotmail.com</a><br><a href= > </a><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top