Cancel/close form command button causes app to close 
Author Message
 Cancel/close form command button causes app to close

I am using ACCESS 2000; frmTrnsact is used to to Add, Edit, Save, etc.,
records.

cmdCancel is used to close the form.  cmdCancel's Default and Cancel
Properties are both set to Yes.

Code on this button includes error-trapping code and:
  DoCmd.RunCommand acCmdClose

Under one of the Add, Edit, ... options, clicking cmdCancel quits the
application; cmdCancel works fine on other options.

In Debug, I F8/single-step through the code, but I can't track what happens
because the crash occurs immediately upon clicking cmdCancel.

Other information --

Form:
=====
Examining the text file resulting from using SaveAsText acForm, there are
several blocks of 'garbage' characters, the largest being 136 rows of 67
characters (the last 2 characters are " ,"), and the last line is only 17
characters.  The large block looks like it might be an image, but there are
no images on the form.

The two largest such blocks are
"Name Map = Begin"
PrtDevMode = Begin"

Could this text be a factor?

Crash:
======
The .ldb file remains in the directory.  After normal closing of an mdb it
is erased.

Can anyone help me figure out why single-stepping does not trigger the
error-trapping code and track down why the cmd button crashed the app in
some cases and not in others?

Thanks for any help.

Larry Mehl



Mon, 29 Aug 2005 04:06:45 GMT  
 Cancel/close form command button causes app to close
hello Larry
though i can't tell why youre app is crashing, i have one
idea that might 1)solve this problem and 2)save you from
problems in the future:
when you want to close a form, dont use:
DoCmd.RunCommand acCmdClose
beacuse it doesnt specify the object to be closed!
instead, use:
DoCmd.Close acForm,"FormName"
this statement will never do anything else but youre
intention.
good luck
Erez.

Quote:
>-----Original Message-----
>I am using ACCESS 2000; frmTrnsact is used to to Add,
Edit, Save, etc.,
>records.

>cmdCancel is used to close the form.  cmdCancel's Default
and Cancel
>Properties are both set to Yes.

>Code on this button includes error-trapping code and:
>  DoCmd.RunCommand acCmdClose

>Under one of the Add, Edit, ... options, clicking
cmdCancel quits the
>application; cmdCancel works fine on other options.

>In Debug, I F8/single-step through the code, but I can't
track what happens
>because the crash occurs immediately upon clicking
cmdCancel.

>Other information --

>Form:
>=====
>Examining the text file resulting from using SaveAsText
acForm, there are
>several blocks of 'garbage' characters, the largest being
136 rows of 67
>characters (the last 2 characters are " ,"), and the last
line is only 17
>characters.  The large block looks like it might be an

image, but there are
Quote:
>no images on the form.

>The two largest such blocks are
>"Name Map = Begin"
>PrtDevMode = Begin"

>Could this text be a factor?

>Crash:
>======
>The .ldb file remains in the directory.  After normal

closing of an mdb it

- Show quoted text -

Quote:
>is erased.

>Can anyone help me figure out why single-stepping does
not trigger the
>error-trapping code and track down why the cmd button
crashed the app in
>some cases and not in others?

>Thanks for any help.

>Larry Mehl

>.



Mon, 29 Aug 2005 08:38:33 GMT  
 Cancel/close form command button causes app to close
Thanks Erez.

Larry


Quote:
> hello Larry
> though i can't tell why youre app is crashing, i have one
> idea that might 1)solve this problem and 2)save you from
> problems in the future:
> when you want to close a form, dont use:
> DoCmd.RunCommand acCmdClose
> beacuse it doesnt specify the object to be closed!
> instead, use:
> DoCmd.Close acForm,"FormName"
> this statement will never do anything else but youre
> intention.
> good luck
> Erez.

> >-----Original Message-----
> >I am using ACCESS 2000; frmTrnsact is used to to Add,
> Edit, Save, etc.,
> >records.

> >cmdCancel is used to close the form.  cmdCancel's Default
> and Cancel
> >Properties are both set to Yes.

> >Code on this button includes error-trapping code and:
> >  DoCmd.RunCommand acCmdClose

> >Under one of the Add, Edit, ... options, clicking
> cmdCancel quits the
> >application; cmdCancel works fine on other options.

> >In Debug, I F8/single-step through the code, but I can't
> track what happens
> >because the crash occurs immediately upon clicking
> cmdCancel.

> >Other information --

> >Form:
> >=====
> >Examining the text file resulting from using SaveAsText
> acForm, there are
> >several blocks of 'garbage' characters, the largest being
> 136 rows of 67
> >characters (the last 2 characters are " ,"), and the last
> line is only 17
> >characters.  The large block looks like it might be an
> image, but there are
> >no images on the form.

> >The two largest such blocks are
> >"Name Map = Begin"
> >PrtDevMode = Begin"

> >Could this text be a factor?

> >Crash:
> >======
> >The .ldb file remains in the directory.  After normal
> closing of an mdb it
> >is erased.

> >Can anyone help me figure out why single-stepping does
> not trigger the
> >error-trapping code and track down why the cmd button
> crashed the app in
> >some cases and not in others?

> >Thanks for any help.

> >Larry Mehl

> >.



Mon, 29 Aug 2005 12:59:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Cancel/close form command button causes app to close

2. Close command button allows form to be closed when required fields are left blank

3. Disable Access Close Button not Form Close Button?

4. closing a form with cancel button

5. User Form close buttons and timer close

6. Problem with Controlled Closing of a Form when exiting throught the Window-Close-Button

7. Form Close Vs Close Window button problem

8. Close button, closes form to the wrong place

9. Prevent user from closing form using caption close button

10. workbookBeforeClose cancels App close


 
Powered by phpBB® Forum Software © phpBB Group