troubleshooting Question

Help with Cancel Button Code

Avatar of billcute
billcute asked on
Microsoft Access
6 Comments1 Solution461 ViewsLast Modified:
frmWater is bounded to tblWater. In the frmWater form, I have a "Cancel" button (btnCancel).

It is this button I want to modify to clear all currently entered data and starts a new blank page of frmWater when clicked.

The way I presently resolves the problem is by "DoCmd.Close" followed by "DoCmd.OpenForm "frmWater"  which makes refreshing of my form very slow. I will like to dsicard this method and use something much better. Any suggestion will be appreciated.

Here is my current code:
****************
Private Sub btnCancel_Click()
On Error GoTo Err_btnCancel_Click
If Me.Dirty Then
   Me.Undo
End If
'  DoCmd.Close                            <---- I want to remove this command and replace
                                                         it with something better
'  DoCmd.OpenForm "frmWater"   <--- I want to do away with this command
                                                        and replace it with something better
Exit_btnCancel_Click:
    Exit Sub
Err_btnCancel_Click:
    MsgBox Err.Description
    Resume Exit_btnCancel_Click
End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 6 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros