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
|
|||
|
|||
Opening new form and closing the present one?
Good morning!
I made a form with command button that opens a new form. Can I put a piece of code to close the first form in this code too? If so what piece of code and where exactly to put it? -elli- Private Sub Command8_Click() On Error GoTo Err_Command8_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "Frm1" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_Command8_Click: Exit Sub Err_Command8_Click: MsgBox Err.Description Resume Exit_Command8_Click End Sub |
#2
|
|||
|
|||
Opening new form and closing the present one?
Try something like:
Dim stDocName As String Dim stLinkCriteria As String stDocName = "Frm1" DoCmd.OpenForm stDocName, , , stLinkCriteria DoCmd.Close acForm, Me.Name -- Duane Hookom MS Access MVP -- "elli" wrote in message ... Good morning! I made a form with command button that opens a new form. Can I put a piece of code to close the first form in this code too? If so what piece of code and where exactly to put it? -elli- Private Sub Command8_Click() On Error GoTo Err_Command8_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "Frm1" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_Command8_Click: Exit Sub Err_Command8_Click: MsgBox Err.Description Resume Exit_Command8_Click End Sub |
#3
|
|||
|
|||
Opening new form and closing the present one?
Put
DoCmd.Close into the OnClick event of your new command button. HTH -- -Larry- -- "elli" wrote in message ... Good morning! I made a form with command button that opens a new form. Can I put a piece of code to close the first form in this code too? If so what piece of code and where exactly to put it? -elli- Private Sub Command8_Click() On Error GoTo Err_Command8_Click Dim stDocName As String Dim stLinkCriteria As String stDocName = "Frm1" DoCmd.OpenForm stDocName, , , stLinkCriteria Exit_Command8_Click: Exit Sub Err_Command8_Click: MsgBox Err.Description Resume Exit_Command8_Click End Sub |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
opening and closing a popup form | Patrick | Using Forms | 3 | December 22nd, 2005 04:25 PM |
closing a form when opening another form | Dan | General Discussion | 2 | December 14th, 2005 09:50 PM |
Closing Forms After Opening A Report | Roger Lord | Using Forms | 2 | February 26th, 2005 03:01 PM |
list box doesn't store the selected value until closing the form | Lin | Using Forms | 2 | November 3rd, 2004 05:34 PM |
Opening another form when closing a form | HighA | General Discussion | 1 | September 2nd, 2004 06:28 AM |