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

Closing Form after next form loaded

Status
Not open for further replies.

vfisher

Programmer
Apr 15, 2002
40
US
Access 97. I have a form that is opened from another form and getting default values from that form. However, I need to close the previous form because it has a table locked that will be needed. I've tried to close the form in the "current" event of the new form but I can't get that to work - I just want to make sure I don't close it before the data being inherited from it is loaded. Any ideas??
 
Try putting it in the ON DIRTY or ACTIVE events for the form.

Crude Example of code:
Form_OnDirty()

Docmd.Close "FormName" ...

End Sub

That should work. It will only close the form if you have some type of action taking place on the form itself.

By then the default should have loaded.

Hope it helped JerseyBoy
Remember: self-praise is no recommendation
 
In the form that closes, you can add the following after the OpenForm command.

Me.SetFocus
DoCmd.Close
 
You can use the follow:

Dim strFormName As String
strFormName = "Name of Form to Close"
DoCmd.Close acForm, strFormName

Works every tiem for me....And with this method you can force it to close anywhere in you code you want, after you have finished any necessary proceeses first. Robert L. Johnson III, A+, Network+
robert.l.johnson.iii@citi.com
Access Database Designer/Administrator
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top