fraser_lindsay
Access wannabe
- Local time
- Today, 22:39
- Joined
- Sep 7, 2005
- Messages
- 218
Hi,
I have been using this code to close all open forms when loading another form. I launch it form a command button and it keeps things tidy.
However, now I would like to exclude one form - I want to keep one form open, but hidden, no matter what.
How do I write that into the code?
I was thinking it would be in this line
I tried "frm*" to only close forms titled frm-something and removed the 'frm' from the form I want to keep open.
That's didn't work .
Can anyone help please?
Thanks
I have been using this code to close all open forms when loading another form. I launch it form a command button and it keeps things tidy.
However, now I would like to exclude one form - I want to keep one form open, but hidden, no matter what.
How do I write that into the code?
Code:
'This code closes all open forms in the current project and then opens the named form in quotations
Dim obj As Object
Dim strName As String
For Each obj In Application.CurrentProject.AllForms
If obj.Name <> "Your Form" Then
DoCmd.Close acForm, obj.Name, acSaveNo
End If
Next obj
DoCmd.OpenForm "Switchboard", acNormal, "", "", acEdit, acNormal
I was thinking it would be in this line
Code:
If obj.Name <> "Your Form" Then
I tried "frm*" to only close forms titled frm-something and removed the 'frm' from the form I want to keep open.
That's didn't work .
Can anyone help please?
Thanks