Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I close two windows with one command button? 2

Status
Not open for further replies.

gnibbles

Programmer
Mar 15, 2000
79
CA
Ive been playing around a bit and I tweeked out the original code a little bit and I want to be able to close the present form and then the switchboard all in the one button. Here is what I have so far:<br><br>Private Sub BackView_Click()<br>&nbsp;&nbsp;&nbsp;&nbsp;'goes back to switchboard and closes form<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Dim stDocName As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim stLinkCriteria As String<br><br>&nbsp;&nbsp;&nbsp;&nbsp;stDocName = &quot;Switchboard&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.OpenForm stDocName, , , stLinkCriteria<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.Close acForm, Me.Name<br><br>&nbsp;&nbsp;&nbsp;&nbsp;<br>End Sub<br><br>Private Sub ExitView_Click()<br>'closes form<br>DoCmd.Close acForm, Me.Name<br>&nbsp;&nbsp;&nbsp;&nbsp;<br>End Sub
 
so just add an extra line to close the other too.<br>Private Sub BackView_Click()<br>&nbsp;&nbsp;&nbsp;&nbsp;'goes back to switchboard and closes form<br><br>&nbsp;&nbsp;&nbsp;&nbsp;Dim stDocName As String<br>&nbsp;&nbsp;&nbsp;&nbsp;Dim stLinkCriteria As String<br><br>&nbsp;&nbsp;&nbsp;&nbsp;stDocName = &quot;Switchboard&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.OpenForm stDocName, , , stLinkCriteria<br><br>&nbsp;&nbsp;&nbsp;&nbsp;' Close the other form before you close the form that this code is in. OK<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.Close acForm, &quot;Other_form_name&quot; '&lt;&lt;&lt;&lt;&lt; Name of other form<br>&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;DoCmd.Close acForm, Me.Name<br><br>End Sub<br> <p>DougP<br><a href=mailto: dposton@universal1.com> dposton@universal1.com</a><br><a href= > </a><br> Ask me how Bar-codes can help you be more productive.
 
Thanks alot i didnt think it would be that simple *L*
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top