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

Have problem with ".OldValue" and Form_BeforeUpdate...Still

Status
Not open for further replies.

farcanal

IS-IT--Management
Jun 29, 2006
9
ZA
Hi
I am trying to get the user to exit my form (or move to th next record using the nav bar) without saving his changes
So far...
Private Sub Form_BeforeUpdate(Cancel As Integer)

If MsgBox("Exit without Saving?", vbYesNo) = vbYes Then

(This part I copied from MSA Help on 'OldValue')

Dim ctlTextbox As Control

For Each ctlTextbox In Me.Controls
If ctlTextbox.ControlType = acTextBox Then
ctlTextbox.Value = ctl.OldValue
End If
Next ctlTextbox

Exit Sub
Else
Cancel = True
End If
End Sub

But I get a RT Error 424 - "Object required"...on line 'ctlTextbox.Value = ctl.OldValue'

Any ideas - thanks in advance
 
ctlTextbox.Value = ctl[!]Textbox[/!].OldValue

what about Me.Undo ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV - have tried it before...

I get RT Error 2448 "You can't assign a value to this object" ??!!??
 
PHV - The 'Me.Undo' idea worked a treat - thanks a mill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top