Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 13th, 2004, 10:07 AM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Newbie Close Button

I am a raw newbie, not a programmer.

I have spent hours on this problem and cannot get it right.

I have a form. I have a close button that I created on the form. The form will close and save data.

I would like to create a second button. The second button would close the form but not save anything. If the form has data in it, I still want the form to close and not save anything. If there is NO data in the form, I want the form to close and not save.

If I use something like "undo" the form will generate error messages that must be clicked on if there is no data in the form to delete. I don't want the users to have to deal with error messages.

I just want the user to have one button that will close and NOT save data if there is or isn't data in the form and give him no error messages to deal with.

How would you set up a close button to close, not save, and not generate any error messages at all? And since I'm a novice I would have to know what form or button properties must be set as well to make the macro or code to function properly.

This has been very frustrating. I need help at a very basic level here as in really spell it out, exactly what I need to do.



  #2 (permalink)  
Old June 13th, 2004, 04:12 PM
Registered User
 
Join Date: Jun 2004
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I found some help on another board. This works if you build an event. It traps from a "dirty form" then uses the undo command only if there is something to undo. The end result is that the form closes if it has or hasn't had any data added to it, nothing is saved, no error messages are generated.

If Me.Dirty Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
End If
DoCmd.Close



Similar Threads
Thread Thread Starter Forum Replies Last Post
Need Help with the close(X) button. chobo2 C# 2008 aka C# 3.0 2 October 22nd, 2008 11:08 PM
trying to close browser in a button taliosfalcon ASP.NET 1.0 and 1.1 Basics 1 February 7th, 2005 12:11 AM
Close button removal canuck38 Access 4 July 16th, 2004 03:50 AM
Access Close Button stoneman Access 9 July 7th, 2004 02:53 PM
Disable Close Button Ben Horne Access VBA 1 April 12th, 2004 03:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.