473,796 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to tell if application object is used...

Hello,

How do I tell if a variable dim'd as an Access.Applicat ion has something in
it.

dim mApp as Access.Applicat ion

set mApp = new Access.Applicat ion
mApp.OpenCurren tDatabase mydb.mdb

That works fine, then I close it

mApp.Quit

I "Quit" instead of .CloseCurrentDa tabase so the msaccess.exe closes

Now I want to test if mApp has a db open. (I know it doesn't at this point,
but I need this for later)

Because I've already used mApp, Is Nothing does not work. All other
properties I've tried give me a message of "The remote server machine does
not exist or is unavailable".

Is there a way to check?

Thanks.

Matthew Wells
MW****@FirstByt e.net
Oct 28 '06 #1
8 1701
Matthew Wells wrote:
Now I want to test if mApp has a db open. (I know it doesn't at this point,
but I need this for later)
After you open another database again, use this:

mApp.CurrentDb. Name

If it has a name property *that's* the database it has open. If it errors
out, no database is open for that application object.

--
Message posted via http://www.accessmonster.com

Oct 29 '06 #2
I know it's a common practice, but I don't like to deliberately create an
error. I'm trying to find a definite property that tells me the state of
the object. Are there any?

"Granny Spitz via AccessMonster.c om" <u26473@uwewrot e in message
news:6876b6307c 8b8@uwe...
Matthew Wells wrote:
Now I want to test if mApp has a db open. (I know it doesn't at this
point,
but I need this for later)

After you open another database again, use this:

mApp.CurrentDb. Name

If it has a name property *that's* the database it has open. If it errors
out, no database is open for that application object.

--
Message posted via http://www.accessmonster.com

Oct 29 '06 #3
Matthew Wells wrote:
I know it's a common practice, but I don't like to deliberately create an
error.
That's what error handling is for. As any experienced programmer will tell
you, sometimes deliberately creating an error so that execution jumps to the
error handler is the easiest way to accomplish some tasks.
I'm trying to find a definite property that tells me the state of
the object. Are there any?
My advice was to check if the CurrentDb had a name, because that's the best
way I know how to do what you asked for. If you think I'm deliberately
withholding information from you see for yourself in the Object Browser.

--
Message posted via http://www.accessmonster.com

Oct 29 '06 #4
Matthew Wells wrote:
I know it's a common practice, but I don't like to deliberately create an
error. I'm trying to find a definite property that tells me the state of
the object. Are there any?
Of course there are, but I am permitted to tell you only if Granny
gives her approval. I'm sorry.

Oct 29 '06 #5
Lyle Fairfield wrote:
Of course there are, but I am permitted to tell you only if Granny
gives her approval.
Lyle knows more about Access than I do. If he says something is so, it must
be. Please let the cat out of the bag, Lyle! You have my gratitude! (And a
plate of oatmeal cookies!)

--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200610/1

Oct 29 '06 #6
I'm trying to find a definite property that tells me the state of
the object. Are there any?
I'd make myApp into a custom class, have a state property, set the
accessObject = nothing when you are not using it.

Keith

Oct 29 '06 #7

Granny Spitz via AccessMonster.c om wrote:
Please let the cat out of the bag, Lyle! You have my gratitude! (And a
plate of oatmeal cookies!)
This cat hasn't a clue, Granny!

I could speculate that Access and databases have little or no direct
interaction. It's DAO that works with the db and Access simply gives us
an interface to interact with that DAO. So I supsect that open or
closed, something ot nothing, quit or unquit, Access applications do
not "have" databases. They may or may not create and expose an instance
of DAO that may "have" a database, but there is no intrinsic property
of an Access application that contains or references a db (No, not
CurrentDB which is simply a channel to a copy of the default db made by
DAO). Access is a bunch of screen procedures and connects to VBA and,
usually, DAO. It's an ActiveX/Com host.

Of course, once we quit the Access application it's a bit much to think
the pointer to it will still have properties. The variable is not the
application; it's simply a pointer to a pointer to a memory location
where there is a pointer to the application object.

.... blah blah blah

Oct 30 '06 #8
Lyle Fairfield wrote:
I could speculate that Access and databases have little or no direct
interaction. It's DAO that works with the db and Access simply gives us
an interface to interact with that DAO.
Thanks for that information, Lyle. At least Matthew has a course of action
despite the inadequacies of the interaction between the Access application
and DAO.

--
Message posted via AccessMonster.c om
http://www.accessmonster.com/Uwe/For...ccess/200610/1

Oct 30 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2559
by: Ted Byers | last post by:
I have gotten to the point where attempting to run my application using "java -jar HotSpotImageTest.jar" no longer generates a complaint about not finding function main. It turned out that the problem was that there was a package statement as the first line of the code generated by Borland's JBuilder IDE. Yes, I used JBuidler's form designer to create it. I don't normally worry about adding "package" to code I write, and didn't much care...
16
1866
by: Timothy Madden | last post by:
Hy I have destructors that do some functional work in the program flow. The problem is destructors should only be used for clean-up, because exceptions might rise at any time, and destructors will be called for clean-up only. So how can I tell, from within the destructor, if the call has been made as part of normal flow of control and the destructor can play its functional role, or if the call has been made as a result of an...
7
2321
by: Marco Martin | last post by:
Hi Group, I've been working on an application that reads data from a comm port and 1) writes the data to file, 2) displays this data in three different graphs in real time.The port is receiving data at 38400 baud, the plan is that it will go up to 115k baud. My app works fine on my development pc (P4 2.6G), But when the application runs on a pc that is slower (Like a p3 laptop that is used when on the road) it freezes. The laptop cant...
5
2410
by: Franco, Gustavo | last post by:
Hi, I have a question, and please I need a answer. How can I finalize a thread running with Application.Run (I need the message loop!!!) without call Thread.Abort?. I want to call Application.ExitThread in the same thread that it is running.
3
9836
by: Sushil Srivastava | last post by:
Hi Guys, Would you be able to help me using C# GUI (with user interface component) in my MFC application. I have used managed extension, COM-interops, etc but problem is this C# component has user interface. how should have get window handle from managed windows? Thanks in advance. Sushil
4
1663
by: Keith Chadwick | last post by:
I am having some trouble referencing an Application("myVar") variable from within a module.vb file on my ASP.NET site. According to the documentation I should be able to reference System.Web.HttpApplication but it does not seem to like that one bit. I also have a MSXML2.DOMDocument30 defined as a public object within the vb module which is loaded during the application start up with a bunch of XML. What is weird is that the data contained...
3
1923
by: SL | last post by:
All, As I understand it, a single application (i.e. IIS virtual directory) in ASP.NET may in fact have more than one corresponding HttpApplicationState object (more or less one per server thread, I think). During each request, only one of these objects is exposed to the page as Page.Application. This seems to be supported by the fact that when I use the debugger, I can see the Application_Start event firing more than one time even...
1
1463
by: Jim | last post by:
Hello, I am creating a windows form application using vb.net 2003 which displays data in a datagrid, and then, if the user wants, I produce a nicely formatted crystal report of the data. The question I have is: if I allow the user to sort the datagrid by clicking on the column header, is there any way that I can tell which column the datagrid is sorted on, so that I can sort the data in the crystal report the same way?
4
4531
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst child apps of an IIS application and can be used by multiple users during the application life cycle and for multiple page loads for the same or different page under a root application. What I don't understand and need to know is whether that...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10449
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10168
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9047
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7546
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6785
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5440
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.