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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|