[AccessD] Closing form problem

Rocky Smolin rockysmolin at bchacc.com
Wed Jan 6 12:46:42 CST 2016


Ok - here's a real kludgey workaround that I used once upon a time when I
had a similar problem - slightly embarrassing so please no attribution. :)

Make a command button and make its height and width really really small
(because it has to be visible). Place it in a corner of your of your form or
behind another control. Then in that Exit (or the Lost Focus) set the focus
to that teeny command button.  Then in the Got Focus event of the command
button, close your form. 

I'm ashamed to even write this but HTH :)

rocky


-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Kaup, Chester
Sent: Wednesday, January 06, 2016 10:34 AM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Closing form problem

I tried moving the event procedure to the lost focus event and then closing
the form but still not success. The save record and dirty commends run fine.
Code as below. I am still at a loss as to wny I cannot close the form in
code but the close button works fine.

Private Sub Not_defined_LostFocus()
    Stop
    DoCmd.RunCommand acCmdSaveRecord
    Me.Dirty = False
End Sub

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Rocky Smolin
Sent: Wednesday, January 06, 2016 10:39 AM
To: 'Access Developers discussion and problem solving'
Subject: Re: [AccessD] Closing form problem

I would try either placing DoEvents before the .Close line or use the after
update event.  But the second might not work if they don't make an entry in
the box. Not sure.

Rocky Smolin
Beach Access Software
858-259-4334
www.bchacc.com
www.e-z-mrp.com
Skype: rocky.smolin
 
 

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of
Kaup, Chester
Sent: Wednesday, January 06, 2016 7:05 AM
To: Access Developers discussion and problem solving
Subject: [AccessD] Closing form problem

I have a data entry form tied to a table. When the data entry has been made
in the last text box I want to close the form. I have the following event
procedure on the exit event of the text box. I get an error message. I am
not seeing what I am doing wrong. Thanks.

RunTime Error 2585
This action can't be carried out while processing a form or report event.

Private Sub Not_defined_Exit(Cancel As Integer)
    DoCmd.Close acForm, "frm Cisco Sands Input", acSaveYes End Sub

I tried adding this but it did not help

Private Sub Not_defined_AfterUpdate()
    DoCmd.RunCommand acCmdSaveRecord
End Sub
--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com

--
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list