Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 2 / January 2008

Tip: Looking for answers? Try searching our database.

Close a form with dbCmd

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jack Witt - 17 Jan 2008 03:23 GMT
I have a form that I use to enter data into a table. I put a button at the
bottom of the form that I can use if I decide to cancel and exit the form if
I change my mind. However, when I use the Cancel button it closes the form
but also puts the data into a new record in the database. This happens even
if I blank out all the fields. I am using the dbCmd.close function. Is there
an option I can add to this function to tell it not to save? Or is there a
cancel function that would do this? I'm fairly new at this so hopefully
there is an easy way to do it.

Thanks, Jack
Tom van Stiphout - 17 Jan 2008 03:45 GMT
DoCmd.Close does the same thing as closing the form with the X in the
upper-right corner. MSFT had to choose between cancelling that record,
or saving it. They chose the latter. I would argue rightfully so.
So what you want to do in your Cancel button is first to cancel saving
the record, then close the form:
RunCommand acCmdUndo
DoCmd.Close

-Tom.

>I have a form that I use to enter data into a table. I put a button at the
>bottom of the form that I can use if I decide to cancel and exit the form if
[quoted text clipped - 6 lines]
>
>Thanks, Jack
Jack Witt - 17 Jan 2008 20:24 GMT
Thanks, Tom. That fixed it!
   Jack

> DoCmd.Close does the same thing as closing the form with the X in the
> upper-right corner. MSFT had to choose between cancelling that record,
[quoted text clipped - 19 lines]
>>
>>Thanks, Jack
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.