PC Review


Reply
Thread Tools Rate Thread

Close a form with dbCmd

 
 
Jack Witt
Guest
Posts: n/a
 
      17th Jan 2008
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

 
Reply With Quote
 
 
 
 
Tom van Stiphout
Guest
Posts: n/a
 
      17th Jan 2008
On Wed, 16 Jan 2008 20:23:59 -0700, "Jack Witt"
<(E-Mail Removed)> wrote:

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
>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

 
Reply With Quote
 
Jack Witt
Guest
Posts: n/a
 
      17th Jan 2008
Thanks, Tom. That fixed it!
Jack

"Tom van Stiphout" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> On Wed, 16 Jan 2008 20:23:59 -0700, "Jack Witt"
> <(E-Mail Removed)> wrote:
>
> 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
>>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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Close button on a form will not close form - error 2585 - action cannot be carried out while processing a form Angus Comber Microsoft Access 2 19th Jul 2006 12:21 PM
Clear Checkbox field on close of form or close of report =?Utf-8?B?QnJvb2s=?= Microsoft Access Form Coding 2 14th Jan 2006 09:31 PM
How to close parent form and not to close a child form also? Viper Microsoft C# .NET 5 15th Oct 2004 08:33 PM
How to close a userform in a forusers, close protected form? De Wilde Eddy Microsoft Excel New Users 1 7th Jun 2004 06:58 PM
Can't Design View or close form, or close Access Bradley C. Hammerstrom Microsoft Access Forms 1 23rd Sep 2003 07:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:31 PM.