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 » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Opening new form and closing the present one?



 
 
Thread Tools Display Modes
  #1  
Old February 24th, 2006, 05:17 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default 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  
Old February 24th, 2006, 05:38 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default 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  
Old February 24th, 2006, 08:45 AM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default 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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
opening and closing a popup form Patrick Using Forms 3 December 22nd, 2005 05:25 PM
closing a form when opening another form Dan General Discussion 2 December 14th, 2005 10:50 PM
Closing Forms After Opening A Report Roger Lord Using Forms 2 February 26th, 2005 04:01 PM
list box doesn't store the selected value until closing the form Lin Using Forms 2 November 3rd, 2004 06:34 PM
Opening another form when closing a form HighA General Discussion 1 September 2nd, 2004 06:28 AM


All times are GMT +1. The time now is 10:36 AM.


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