A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

How to close a form from its subform



 
 
Thread Tools Display Modes
  #1  
Old December 16th, 2009, 12:30 PM posted to microsoft.public.access.forms
.Len B
external usenet poster
 
Posts: 81
Default How to close a form from its subform

Form_BeforeUpdate(Cancel As Integer)
If Not chkOk2Save Then
Cancel = True
MsgBox "Ok to save is not checked"
Else
MsgBox "Saving"
DoCmd.Close acForm, Forms!frmEnterNotes

End If

I have tried several combinations of the line.
Me.Parent.Close
DoCmd.Close
DoCmd.Close acForm, Forms("frmEnterNotes")
All fail with different errors.

What is the correct way to do this?
Or do I have to close from the parent?
--
Len
__________________________________________________ ____
remove nothing for valid email address.


  #2  
Old December 16th, 2009, 12:55 PM posted to microsoft.public.access.forms
Douglas J. Steele[_3_]
external usenet poster
 
Posts: 3,143
Default How to close a form from its subform

Close is looking for a name, not an object.

Try:

DoCmd.Close acForm "frmEnterNotes"

or

DoCmd.Close acForm Me.Parent.Name

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)



".Len B" wrote in message
...
Form_BeforeUpdate(Cancel As Integer)
If Not chkOk2Save Then
Cancel = True
MsgBox "Ok to save is not checked"
Else
MsgBox "Saving"
DoCmd.Close acForm, Forms!frmEnterNotes

End If

I have tried several combinations of the line.
Me.Parent.Close
DoCmd.Close
DoCmd.Close acForm, Forms("frmEnterNotes")
All fail with different errors.

What is the correct way to do this?
Or do I have to close from the parent?
--
Len
__________________________________________________ ____
remove nothing for valid email address.



  #3  
Old December 16th, 2009, 02:05 PM posted to microsoft.public.access.forms
.Len B
external usenet poster
 
Posts: 81
Default How to close a form from its subform

Intellisense told me it wanted an ObjectName. I saw only Object.
Thanks Douglas. Tried first suggestion. It worked. Stopped there.
--
Len
__________________________________________________ ____
remove nothing for valid email address.
"Douglas J. Steele" wrote in message
...
| Close is looking for a name, not an object.
|
| Try:
|
| DoCmd.Close acForm "frmEnterNotes"
|
| or
|
| DoCmd.Close acForm Me.Parent.Name
|
| --
| Doug Steele, Microsoft Access MVP
| http://I.Am/DougSteele
| (no e-mails, please!)
|
|
|
| ".Len B" wrote in message
| ...
| Form_BeforeUpdate(Cancel As Integer)
| If Not chkOk2Save Then
| Cancel = True
| MsgBox "Ok to save is not checked"
| Else
| MsgBox "Saving"
| DoCmd.Close acForm, Forms!frmEnterNotes
| End If
|
| I have tried several combinations of the line.
| Me.Parent.Close
| DoCmd.Close
| DoCmd.Close acForm, Forms("frmEnterNotes")
| All fail with different errors.
|
| What is the correct way to do this?
| Or do I have to close from the parent?
| --
| Len
| __________________________________________________ ____
| remove nothing for valid email address.
|
|
|



 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:12 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.