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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to delete single field when undo change button is pressed

Status
Not open for further replies.

hu5

Technical User
Apr 9, 2004
28
US
Hi, I put a undo change command button on the form, it only undo the very last change.

The Task textbox will send data into field13 thru field35.
If user enter Task once, and decide to undo change, the record will be deleted.
If user enter Task twice, two separate data already get loaded into field13 and 14, and if user undo change, field14 data remains, I need to delete the last data from field14.
How do I implement this in the sub UndoChange_Click()? Thank you.


Private Sub Task_AfterUpdate()
Dim i As Integer


For i = 13 To 35
If IsNull(Me("field" & i).Value) Then
Me!Task.Value = Me!Task.Value & " " & Now

Me("field" & i).Value = Me!Task.Value
Exit For
End If
Next i


End Sub


Private Sub UndoChange_Click()
On Error GoTo Err_UndoChange_Click



DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70


Exit_UndoChange_Click:
Exit Sub

Err_UndoChange_Click:
MsgBox Err.Description
Resume Exit_UndoChange_Click

End Sub
 
Me.Undo

Your subroutine merely executes the UNDO menuitem which removes the last keystroke. The Me.Undo will undo everything on the form and Me.YourControlName.Undo will undo the entire last entry (since the last save) fromt the control.



---------------------
scking@arinc.com
---------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top