[AccessD] Dirty Cancel Clear all controls
B Heygood
Accesspro at cox.net
Tue Feb 13 12:43:55 CST 2018
I think me.undo is working. But need to clear entries to get to an unsullied
new record.
See on the web that some variable set and checked in the beforeupdate event
might help.....
Private Sub cmdCancel_Click()
On Error GoTo cmdCancel_Click_Error
If Me.Dirty Then Me.Dirty = False
'DoCmd.GoToRecord , , acNewRec
Dim ctlC As Control
' For each control.
For Each ctlC In Me.Controls
If ctlC.ControlType = acTextBox Then
' Clear New Value. THIS IS WHERE THE ERROR HAPPENS ON THE
CONTROL FOR THE PRIMARY KEY ++++
ctlC.Value = "" ' Me.txtEquipID
End If
Next ctlC
Me.Undo
Me.txtEquipID.SetFocus
On Error GoTo 0
Exit Sub
Bob
-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Rocky Smolin
Sent: Tuesday, February 13, 2018 10:30 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Dirty Cancel Clear all controls
Try Me.Undo
r
-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Bob
Heygood
Sent: Tuesday, February 13, 2018 10:03 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] Dirty Cancel Clear all controls
Hello to the list,
I am looking to allow my user to bail and trash all info entered and not
save the record. And goto a new record.
Have a button "Cancel".
I have used the isdirty and the cancel methods of the form.
Somehow not getting it done.
Maybe the order in which I am attempting ??
A 2010 W 8.1
Tia
Bob
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com
More information about the AccessD
mailing list