473,327 Members | 2,016 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

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

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
3 1675
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Danifrog | last post by:
I have a form with a subform and a few buttons that open various reports, tables and forms. Sometimes when I open it in any view or try and save it, the application quits. It does this quickly...
50
by: Jay Balapa | last post by:
Hello, Currently my application has three tiers- 1. Presentation Layer (Asp.Net / Win Forms/ Pocket PC UI.) This predominantly contains User Controls, Custom Controls and Win/Web Forms. I...
9
by: Graham | last post by:
I have been having some fun learning and using the new Controls and methods in .Net 2.0 which will make my life in the future easier and faster. Specifically the new databinding practises and...
2
by: Matthew Hood | last post by:
My company has expressed a desire to convert an existing MS Access application to a full VB.NET application. My experience is with VB6 so I want to ask a few questions and get some input on the...
2
by: Jeff | last post by:
I'm getting an Object Reference error before I even run my app, and I'm not sure where to look to find the cause. I'd appreciate your help. When I open my Windows Application project, the...
4
by: nixon | last post by:
Hi there! Im trying to build a 3 tier application that uses a smartclient in the "view" layer. The communication between the smartclient and the server should be webservices because of potentiel...
3
by: ApexData | last post by:
Hello I completed an application that worked great until I went to STARTUP and shut off all of the checkboxes. My code uses "Application.CurrentObjectName" to get the current Form name. All my...
5
by: Gav | last post by:
I'm writing a windows application (using C# VS 2005 Pro) to access a MS SQL database and although it is working fine (up to now) I'm not sure I'm going about it in the best way. Can anybody point...
2
by: ncsthbell | last post by:
I made some minor code changes to a form (not the main form), closed the app and when I try to open it, my main form will not open, I have a blank screen. I also tried going back into the form I...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.