By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,212 Members | 1,369 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,212 IT Pros & Developers. It's quick & easy.

How to examine application for objects that may be open in design view?

P: n/a
MLH
An A97 application that sometimes stays open for days
at a time may have a form, report, table or query open
in design view. What's the simplest code snippet that
would determine whether any database object was
currently open in design view?
Oct 11 '08 #1
Share this Question
Share on Google+
3 Replies


P: n/a
This would tell you if the form is open and in design view:

strForm = "Form1"
If CurrentProject.AllForms(strForm).IsLoaded Then
Debug.Print Forms(strForm).CurrentView = 0
End If

Won't work for subforms.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CR**@NorthState.netwrote in message
news:q6********************************@4ax.com...
An A97 application that sometimes stays open for days
at a time may have a form, report, table or query open
in design view. What's the simplest code snippet that
would determine whether any database object was
currently open in design view?
Oct 11 '08 #2

P: n/a
You might try.Need to do a loop to check all the forms

Function IsLoaded(ByVal strFormName As String) As String
' Returns True if the specified form is open in Form view or Datasheet
view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
If Forms(strFormName).CurrentView <conDesignView Then
IsLoaded = "Open"
Else
IsLoaded = "Design View"
End If
End If

End Function

Phil
"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:48***********************@per-qv1-newsreader-01.iinet.net.au...
This would tell you if the form is open and in design view:

strForm = "Form1"
If CurrentProject.AllForms(strForm).IsLoaded Then
Debug.Print Forms(strForm).CurrentView = 0
End If

Won't work for subforms.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"MLH" <CR**@NorthState.netwrote in message
news:q6********************************@4ax.com...
>An A97 application that sometimes stays open for days
at a time may have a form, report, table or query open
in design view. What's the simplest code snippet that
would determine whether any database object was
currently open in design view?

Oct 11 '08 #3

P: n/a
This looks like the IsLoaded() function from the Northwind sample database.
It was the standard solution before the AllForms collection was introducted
in 2000.

Of course, it suffers from the same limitation with regard to subforms.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Phil Stanton" <ph**@myfamilyname.co.ukwrote in message
news:-9******************************@posted.plusnet...
You might try.Need to do a loop to check all the forms

Function IsLoaded(ByVal strFormName As String) As String
' Returns True if the specified form is open in Form view or Datasheet
view.

Const conObjStateClosed = 0
Const conDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <>
conObjStateClosed Then
If Forms(strFormName).CurrentView <conDesignView Then
IsLoaded = "Open"
Else
IsLoaded = "Design View"
End If
End If

End Function

Phil
"Allen Browne" <Al*********@SeeSig.Invalidwrote in message
news:48***********************@per-qv1-newsreader-01.iinet.net.au...
>This would tell you if the form is open and in design view:

strForm = "Form1"
If CurrentProject.AllForms(strForm).IsLoaded Then
Debug.Print Forms(strForm).CurrentView = 0
End If

Won't work for subforms.

"MLH" <CR**@NorthState.netwrote in message
news:q6********************************@4ax.com.. .
>>An A97 application that sometimes stays open for days
at a time may have a form, report, table or query open
in design view. What's the simplest code snippet that
would determine whether any database object was
currently open in design view?
Oct 12 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.