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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Closing a Form1 after opening Form2

Status
Not open for further replies.

damutech

MIS
Joined
Mar 6, 2006
Messages
3
Location
SI
I have a control in Form1 and after LostFocus, it open a Form2, Form1 rests still open. But I want to close Form1 automaticly after opening Form2. How can I do that?

Here is an example:
Form1:
Private Sub POD_LostFocus()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Form2"
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub

Thanks!
 

You could try this:


Private Sub POD_LostFocus()
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Form2"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Close acForm, Me.Name

End Sub
 
How are ya damutech . . .

Try This:
Code:
[blue]   Dim stDocName As String
   Dim stLinkCriteria As String
   
   stDocName = "Form2"
   DoCmd.OpenForm stDocName, , , stLinkCriteria
   [purple][b]DoCmd.Close acForm, "Form1", acSaveYes[/b][/purple][/blue]

Calvin.gif
See Ya! . . . . . .
 
Or you could change the line in Form1 to:

DoCmd.OpenForm stDocName, , , stLinkCriteria, , , stDocName

Then, in Form2's Open event:

If Not IsNull(Me.OpenArgs) then
DoCmd.Close acForm, Me.OpenArgs
End If

Especially good when opening Form2 in Dialog mode.

HTH

[pipe]
Daniel Vlas
Systems Consultant

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top