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
|
|||
|
|||
Keep form open after Query command is excecuted?
I'm looking for a way to keep this Form open when the user closes the query.
Any Ideas or help would be appreciated. I have the following form code: Private Sub cmdCancel_Click() DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdOK_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdViewPrint_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.PrintOut DoCmd.Close acForm, "frmEmbQueryName" End Sub |
#2
|
|||
|
|||
Keep form open after Query command is excecuted?
Add this line after you close the form
DoCmd.Open acForm, "frmEmbQueryName" -- Jeff C Live Well .. Be Happy In All You Do "Evert" wrote: I'm looking for a way to keep this Form open when the user closes the query. Any Ideas or help would be appreciated. I have the following form code: Private Sub cmdCancel_Click() DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdOK_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdViewPrint_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.PrintOut DoCmd.Close acForm, "frmEmbQueryName" End Sub |
#3
|
|||
|
|||
Keep form open after Query command is excecuted?
I added the line after the docmd.close and got a compile error " method or
data member not found" Pointing to Private sub cmdOK any suggestions? "Jeff C" wrote: Add this line after you close the form DoCmd.Open acForm, "frmEmbQueryName" -- Jeff C Live Well .. Be Happy In All You Do "Evert" wrote: I'm looking for a way to keep this Form open when the user closes the query. Any Ideas or help would be appreciated. I have the following form code: Private Sub cmdCancel_Click() DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdOK_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdViewPrint_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.PrintOut DoCmd.Close acForm, "frmEmbQueryName" End Sub |
#4
|
|||
|
|||
Keep form open after Query command is excecuted?
On Tue, 26 Dec 2006 09:16:01 -0800, Evert
wrote: I'm looking for a way to keep this Form open when the user closes the query. Any Ideas or help would be appreciated. I have the following form code: Private Sub cmdCancel_Click() DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdOK_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdViewPrint_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.PrintOut DoCmd.Close acForm, "frmEmbQueryName" End Sub Why open the Query at all!? Query datasheets are generally best kept "under the hood". If you want to display the data in qryEmbName, it's best to view it on a Form; if you wish to print that information out, create a Report based on qryEmbName and open that report (rather than using the Printout method). If you don't want to close frmEmbQueryName, then remove or comment out the line DoCmd.Close acForm, "frmEmbQueryName". It's only closing the form because you're asking that it be closed! John W. Vinson[MVP] |
#5
|
|||
|
|||
Keep form open after Query command is excecuted?
Thank you, I tried it and it works better
"John Vinson" wrote: On Tue, 26 Dec 2006 09:16:01 -0800, Evert wrote: I'm looking for a way to keep this Form open when the user closes the query. Any Ideas or help would be appreciated. I have the following form code: Private Sub cmdCancel_Click() DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdOK_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.Close acForm, "frmEmbQueryName" End Sub Private Sub cmdViewPrint_Click() If IsNull(cboName) Then MsgBox "Please Select a Name or Cancel" Exit Sub End If DoCmd.OpenQuery "qryEmbName", acViewNormal, acReadOnly DoCmd.PrintOut DoCmd.Close acForm, "frmEmbQueryName" End Sub Why open the Query at all!? Query datasheets are generally best kept "under the hood". If you want to display the data in qryEmbName, it's best to view it on a Form; if you wish to print that information out, create a Report based on qryEmbName and open that report (rather than using the Printout method). If you don't want to close frmEmbQueryName, then remove or comment out the line DoCmd.Close acForm, "frmEmbQueryName". It's only closing the form because you're asking that it be closed! John W. Vinson[MVP] |
Thread Tools | |
Display Modes | |
|
|