 | 
28-Jul-2006, 08:34 AM
|  | Guest | | | | | | | | | | module code to close a form does not work Hello
I have a form called NewPolicy. On this form is a button which calls some
VBA code. At the end of the code is the line: Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/information-technology/13129-module-code-close-form-does-not.html
DoCmd.Close acForm, [Forms]![NewPolicy], acSaveNo
But this line does not close the form! What am I doing wrong?
Angus * Got anything to share on This Topic? Why not share your immediate thoughts/reaction with us! Login Now! or Sign Up Today! to share your views... Gurfateh! | 
28-Jul-2006, 08:34 AM
|  | Guest | | | | | | | | | | Re: module code to close a form does not work The Close method is looking for the name of the object to close, not a Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13129Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13129
reference to it.
Try:
DoCmd.Close acForm, "NewPolicy", acSaveNo
--
Doug Steele, Microsoft Access MVP http://I.Am/DougSteele
(no private e-mails, please)
"Angus Comber" wrote in message
news:eHqaLGgpGHA.2400@TK2MSFTNGP03.phx.gbl...
> Hello
>
> I have a form called NewPolicy. On this form is a button which calls some
> VBA code. At the end of the code is the line:
>
> DoCmd.Close acForm, [Forms]![NewPolicy], acSaveNo
>
> But this line does not close the form! What am I doing wrong?
>
> Angus
>
> | 
28-Jul-2006, 08:34 AM
|  | Guest | | | | | | | | | | Re: module code to close a form does not work On Wed, 12 Jul 2006 23:21:10 +0100, "Angus Comber"
wrote:
>Hello
>
>I have a form called NewPolicy. On this form is a button which calls some
>VBA code. At the end of the code is the line:
>
>DoCmd.Close acForm, [Forms]![NewPolicy], acSaveNo
>
>But this line does not close the form! What am I doing wrong?
>
>Angus
>
You're not passing the *name of the form as a text string* in the
second argument of the Close event - you're passing the Form as an
object.
Use either
DoCmd.Close acForm, "NewPolicy", acSaveNo
or (more flexibly) Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13129 Reference:: Sikh Philosophy Network http://www.sikhphilosophy.net/showthread.php?t=13129
DoCmd.Close acForm, Me.Name, acSaveNo
John W. Vinson[MVP] | 
Support Us! Become a Promoter! | | Gurfateh ji, you can become a SPN Promoter by Donating as little as $10 each month. With limited resources & high operational costs, your donations make it possible for us to deliver a quality website and spread the teachings of the Sri Guru Granth Sahib Ji, to serve & uplift humanity. Every contribution counts. Donate Generously. Gurfateh! | (View-All)
Members who have read this thread : 0
| | There are no names to display. | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Tools | Search | | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is On | | | | » Active Discussions | | | | | | | Kirtan Today 21:24 PM 0 Replies, 20 Views | Panjabi Today 21:22 PM 15 Replies, 294 Views | | | | | | | | | | | | | | | | | | | | | » Books You Should Read... | | | |